Fixed: [YANG 'when' does not work in multiple grouping](https://github.com/clicon/clixon/issues/572)
This commit is contained in:
parent
54a8f51bfd
commit
0307aa5374
6 changed files with 113 additions and 70 deletions
|
|
@ -363,11 +363,9 @@ main(int argc,
|
|||
enum format_enum config_dump_format = FORMAT_XML;
|
||||
int print_version = 0;
|
||||
int32_t d;
|
||||
#if 1
|
||||
char *buf = NULL;
|
||||
size_t bufsize = 0;
|
||||
int err;
|
||||
#endif
|
||||
int ret;
|
||||
|
||||
/* Create handle */
|
||||
if ((h = clixon_handle_init()) == NULL)
|
||||
|
|
@ -379,35 +377,24 @@ main(int argc,
|
|||
goto done;
|
||||
|
||||
/* Set username to clixon handle. Use in all communication to backend */
|
||||
#if 1
|
||||
{
|
||||
bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
|
||||
if (bufsize == -1){
|
||||
bufsize = 16384;
|
||||
}
|
||||
if ((buf = malloc(bufsize)) == NULL){
|
||||
clixon_err(OE_UNIX, errno, "malloc");
|
||||
goto done;
|
||||
}
|
||||
err = getpwuid_r(getuid(), &pw, buf, bufsize, &pwresult);
|
||||
if (pwresult == NULL) {
|
||||
if (err == 0)
|
||||
clixon_err(OE_UNIX, errno, "getpwuid_r");
|
||||
else
|
||||
clixon_err(OE_UNIX, err, "getpwuid_r");
|
||||
goto done;
|
||||
}
|
||||
bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
|
||||
if (bufsize == -1){
|
||||
bufsize = 16384;
|
||||
}
|
||||
if ((buf = malloc(bufsize)) == NULL){
|
||||
clixon_err(OE_UNIX, errno, "malloc");
|
||||
goto done;
|
||||
}
|
||||
ret = getpwuid_r(getuid(), &pw, buf, bufsize, &pwresult);
|
||||
if (pwresult == NULL) {
|
||||
if (ret == 0)
|
||||
clixon_err(OE_UNIX, errno, "getpwuid_r");
|
||||
else
|
||||
clixon_err(OE_UNIX, ret, "getpwuid_r");
|
||||
goto done;
|
||||
}
|
||||
if (clicon_username_set(h, pw.pw_name) < 0)
|
||||
goto done;
|
||||
#else
|
||||
if ((pw = getpwuid(getuid())) == NULL){
|
||||
clixon_err(OE_UNIX, errno, "getpwuid");
|
||||
goto done;
|
||||
}
|
||||
if (clicon_username_set(h, pw->pw_name) < 0)
|
||||
goto done;
|
||||
#endif
|
||||
while ((c = getopt(argc, argv, SNMP_OPTS)) != -1)
|
||||
switch (c) {
|
||||
case 'h' : /* help */
|
||||
|
|
@ -625,10 +612,8 @@ main(int argc,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
#if 1
|
||||
if (buf)
|
||||
free(buf);
|
||||
#endif
|
||||
clixon_log_init(h, __PROGRAM__, LOG_INFO, 0); /* Log on syslog no stderr */
|
||||
clixon_log(h, LOG_NOTICE, "%s: %u Terminated", __PROGRAM__, getpid());
|
||||
snmp_terminate(h);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue