Make shadow_logfd and Prog not extern

Closes #444
Closes #465

Signed-off-by: Serge Hallyn <serge@hallyn.com>
This commit is contained in:
Serge Hallyn
2021-11-28 17:37:53 -06:00
parent b8c67c320c
commit 79157cbad8
79 changed files with 371 additions and 217 deletions

View File

@@ -38,12 +38,13 @@
#include "subordinateio.h"
#include "idmapping.h"
#include "subid.h"
#include "shadowlog.h"
static const char *Prog = "(libsubid)";
static FILE *shadow_logfd;
bool subid_init(const char *progname, FILE * logfd)
{
FILE *shadow_logfd;
if (progname) {
progname = strdup(progname);
if (progname)
@@ -53,14 +54,15 @@ bool subid_init(const char *progname, FILE * logfd)
}
if (logfd) {
shadow_logfd = logfd;
log_set_logfd(logfd);
return true;
}
shadow_logfd = fopen("/dev/null", "w");
if (!shadow_logfd) {
shadow_logfd = stderr;
log_set_logfd(stderr);
return false;
}
log_set_logfd(shadow_logfd);
return true;
}