SNMP frontend: conflict typos, snmp pidfile

This commit is contained in:
Olof hagsand 2022-05-17 18:30:54 +02:00
parent 5172cf15fa
commit 42f21a309a
5 changed files with 35 additions and 7 deletions

View file

@ -1004,7 +1004,7 @@ main(int argc,
goto done;
/* Write pid-file */
if ((pid = pidfile_write(pidfile)) < 0)
if (pidfile_write(pidfile) < 0)
goto done;
if (set_signal(SIGTERM, backend_sig_term, NULL) < 0){

View file

@ -60,6 +60,14 @@
/* Command line options to be passed to getopt(3) */
#define SNMP_OPTS "hD:f:l:o:"
/*! Return (hardcoded) pid file
*/
static char*
clicon_snmp_pidfile(clicon_handle h)
{
return "/var/tmp/clixon_snmp.pid";
}
/*! Signal terminates process
* Just set exit flag for proper exit in event loop
*/
@ -197,6 +205,7 @@ snmp_terminate(clicon_handle h)
yang_stmt *yspec;
cvec *nsctx;
cxobj *x;
char *pidfile = clicon_snmp_pidfile(h);
shutdown_agent();
clicon_rpc_close_session(h);
@ -213,6 +222,8 @@ snmp_terminate(clicon_handle h)
clicon_handle_exit(h);
clixon_err_exit();
clicon_log_exit();
if (pidfile)
unlink(pidfile);
return 0;
}
@ -254,6 +265,7 @@ main(int argc,
size_t cligen_bufthreshold;
int dbg = 0;
size_t sz;
char *pidfile = NULL;
/* Create handle */
if ((h = clicon_handle_init()) == NULL)
@ -415,6 +427,14 @@ main(int argc,
if (dbg)
clicon_option_dump(h, dbg);
/* Check pid-file, if zap kil the old daemon, else return here */
if ((pidfile = clicon_snmp_pidfile(h)) == NULL){
clicon_err(OE_FATAL, 0, "pidfile not set");
goto done;
}
/* Write pid-file */
if (pidfile_write(pidfile) < 0)
goto done;
/* main event loop */
if (clixon_event_loop(h) < 0)
goto done;

View file

@ -214,7 +214,7 @@ snmp_table_handler(netsnmp_mib_handler *handler,
}
ok:
retval = SNMP_ERR_NOERROR;
done:
//done:
if (xt)
xml_free(xt);
if (cb)
@ -254,10 +254,7 @@ snmp_scalar_handler(netsnmp_mib_handler *handler,
u_char *snmpval = NULL;
size_t snmplen;
int ret;
<<<<<<< HEAD
=======
netsnmp_variable_list *requestvb; /* sub of requests */
>>>>>>> SNMP frontend: getnext, oid sanity checks and scalar debug
/*
* can be used to pass information on a per-pdu basis from a