summaryrefslogtreecommitdiff
path: root/openbsd-compat/bsd-misc.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-01-10 09:53:12 +1100
committerDamien Miller <djm@mindrot.org>2003-01-10 09:53:12 +1100
commita8ed44b79e6dd78d7871b0fb8149951b54662ef5 (patch)
treecca59d396ec59133ec1c42536eca25d087dcfcc7 /openbsd-compat/bsd-misc.c
parent13b2e55c36ec316bd4ec15e830c9eae888d2cb68 (diff)
- (djm) Enable new setproctitle emulation for Linux, AIX and HP/UX. More
systems may be added later.
Diffstat (limited to 'openbsd-compat/bsd-misc.c')
-rw-r--r--openbsd-compat/bsd-misc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c
index 1c1e43a5..d7180d42 100644
--- a/openbsd-compat/bsd-misc.c
+++ b/openbsd-compat/bsd-misc.c
@@ -23,15 +23,20 @@
*/
#include "includes.h"
+#include "xmalloc.h"
-RCSID("$Id: bsd-misc.c,v 1.10 2002/07/08 21:09:41 mouring Exp $");
+RCSID("$Id: bsd-misc.c,v 1.11 2003/01/09 22:53:13 djm Exp $");
+/*
+ * NB. duplicate __progname in case it is an alias for argv[0]
+ * Otherwise it may get clobbered by setproctitle()
+ */
char *get_progname(char *argv0)
{
#ifdef HAVE___PROGNAME
extern char *__progname;
- return __progname;
+ return xstrdup(__progname);
#else
char *p;
@@ -42,7 +47,8 @@ char *get_progname(char *argv0)
p = argv0;
else
p++;
- return p;
+
+ return xstrdup(p);
#endif
}