diff options
author | Karel Zak | 2006-12-07 00:25:39 +0100 |
---|---|---|
committer | Karel Zak | 2006-12-07 00:25:39 +0100 |
commit | 7eda085c41faa3445b4b168ce78ab18dab87d98a (patch) | |
tree | eb8da4baebd0af68fa84818d3d51b4a3714667fc /lib/setproctitle.c | |
parent | Imported from util-linux-2.9i tarball. (diff) | |
download | kernel-qcow2-util-linux-7eda085c41faa3445b4b168ce78ab18dab87d98a.tar.gz kernel-qcow2-util-linux-7eda085c41faa3445b4b168ce78ab18dab87d98a.tar.xz kernel-qcow2-util-linux-7eda085c41faa3445b4b168ce78ab18dab87d98a.zip |
Imported from util-linux-2.9v tarball.
Diffstat (limited to 'lib/setproctitle.c')
-rw-r--r-- | lib/setproctitle.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/setproctitle.c b/lib/setproctitle.c index bff1362da..319bc6a9f 100644 --- a/lib/setproctitle.c +++ b/lib/setproctitle.c @@ -20,10 +20,6 @@ #include <stdarg.h> #include "setproctitle.h" -#ifndef SPT_PADCHAR -#define SPT_PADCHAR ' ' -#endif - #ifndef SPT_BUFSIZE #define SPT_BUFSIZE 2048 #endif @@ -65,7 +61,6 @@ initproctitle (int argc, char **argv) { /* Nice code, but many places do not know about vsnprintf ... */ void setproctitle (const char *fmt,...) { - char *p; int i; char buf[SPT_BUFSIZE]; va_list ap; @@ -82,16 +77,14 @@ setproctitle (const char *fmt,...) { i = argv_lth - 2; buf[i] = '\0'; } + memset(argv0[0], '\0', argv_lth); /* clear the memory area */ (void) strcpy (argv0[0], buf); - p = &argv0[0][i]; - while (i < argv_lth) - *p++ = SPT_PADCHAR, i++; + argv0[1] = NULL; } #else void setproctitle (const char *prog, const char *txt) { - char *p; int i; char buf[SPT_BUFSIZE]; @@ -108,10 +101,9 @@ setproctitle (const char *prog, const char *txt) { i = argv_lth - 2; buf[i] = '\0'; } + memset(argv0[0], '\0', argv_lth); /* clear the memory area */ (void) strcpy (argv0[0], buf); - p = &argv0[0][i]; - while (i < argv_lth) - *p++ = SPT_PADCHAR, i++; + argv0[1] = NULL; } #endif |