lib: rename Prog to shadow_progname, with only one definition
The build was failing with duplicate symbol errors with -fno-common. This is the default in GCC 10 and later, and explicitly enabled in some distributions to catch problems like this. There were two causes: - Prog and shadow_logfd were defined in a header file that was included in multiple other files. Fix this by defining them once in shadowlog.c, and having extern declarations in the header. - Most of the tools (except id/nologin) also define a Prog variable, which is not intended to alias the one in the library. Fix this by renaming Prog in the library to shadow_progname, which also matches the new accessor functions for it.
This commit is contained in:
@ -60,11 +60,11 @@ int run_command (const char *cmd, const char *argv[],
|
||||
exit (E_CMD_NOTFOUND);
|
||||
}
|
||||
fprintf (shadow_logfd, "%s: cannot execute %s: %s\n",
|
||||
Prog, cmd, strerror (errno));
|
||||
shadow_progname, cmd, strerror (errno));
|
||||
exit (E_CMD_NOEXEC);
|
||||
} else if ((pid_t)-1 == pid) {
|
||||
fprintf (shadow_logfd, "%s: cannot execute %s: %s\n",
|
||||
Prog, cmd, strerror (errno));
|
||||
shadow_progname, cmd, strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ int run_command (const char *cmd, const char *argv[],
|
||||
|
||||
if ((pid_t)-1 == wpid) {
|
||||
fprintf (shadow_logfd, "%s: waitpid (status: %d): %s\n",
|
||||
Prog, *status, strerror (errno));
|
||||
shadow_progname, *status, strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user