Merge pull request #474 from atsampson/subidprogname

Default value for progname/logfd, and set progname in subid_init too
This commit is contained in:
Serge Hallyn 2021-12-27 12:46:34 -06:00 committed by GitHub
commit 92bd73c657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View File

@ -2,8 +2,8 @@
#include "lib/shadowlog_internal.h" #include "lib/shadowlog_internal.h"
const char *shadow_progname; const char *shadow_progname = "libshadow";
FILE *shadow_logfd; FILE *shadow_logfd = NULL;
void log_set_progname(const char *progname) void log_set_progname(const char *progname)
{ {

View File

@ -40,17 +40,16 @@
#include "subid.h" #include "subid.h"
#include "shadowlog.h" #include "shadowlog.h"
static const char *Prog = "(libsubid)";
bool subid_init(const char *progname, FILE * logfd) bool subid_init(const char *progname, FILE * logfd)
{ {
FILE *shadow_logfd; FILE *shadow_logfd;
if (progname) { if (progname) {
progname = strdup(progname); progname = strdup(progname);
if (progname) if (!progname)
Prog = progname;
else
return false; return false;
log_set_progname(progname);
} else {
log_set_progname("(libsubid)");
} }
if (logfd) { if (logfd) {