diff options
author | markm <markm@FreeBSD.org> | 2002-03-29 22:43:43 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2002-03-29 22:43:43 +0000 |
commit | 76fe441a7bf75d73962641b785f158b5cc9dc7f8 (patch) | |
tree | 4e267e060bfb6d96f46ab0d79c49b277402c0dd0 /lib/libc/gen/setproctitle.c | |
parent | 6085f75ded37ec415ded7d6373ecd09bcb088ac4 (diff) | |
download | FreeBSD-src-76fe441a7bf75d73962641b785f158b5cc9dc7f8.zip FreeBSD-src-76fe441a7bf75d73962641b785f158b5cc9dc7f8.tar.gz |
Do not use __progname directly (except in [gs]etprogname(3)).
Also, make an internal _getprogname() that is used only inside
libc. For libc, getprogname(3) is a weak symbol in case a
function of the same name is defined in userland.
Diffstat (limited to 'lib/libc/gen/setproctitle.c')
-rw-r--r-- | lib/libc/gen/setproctitle.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/gen/setproctitle.c b/lib/libc/gen/setproctitle.c index b9b8418..d6101e1 100644 --- a/lib/libc/gen/setproctitle.c +++ b/lib/libc/gen/setproctitle.c @@ -18,6 +18,7 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "namespace.h" #include <sys/types.h> #include <sys/param.h> #include <sys/exec.h> @@ -31,6 +32,9 @@ __FBSDID("$FreeBSD$"); #include <string.h> #include <stdlib.h> #include <unistd.h> +#include "un-namespace.h" + +#include "libc_private.h" /* * Older FreeBSD 2.0, 2.1 and 2.2 had different ps_strings structures and @@ -53,7 +57,6 @@ struct old_ps_strings { #include <stdarg.h> #define SPT_BUFSIZE 2048 /* from other parts of sendmail */ -extern char * __progname; /* is this defined in a .h anywhere? */ void setproctitle(const char *fmt, ...) @@ -83,7 +86,7 @@ setproctitle(const char *fmt, ...) len = 0; } else { /* print program name heading for grep */ - (void) snprintf(buf, sizeof(buf), "%s: ", __progname); + (void)snprintf(buf, sizeof(buf), "%s: ", _getprogname()); len = strlen(buf); } |