]> andersk Git - openssh.git/blobdiff - openbsd-compat/bsd-misc.c
- (djm) Enable new setproctitle emulation for Linux, AIX and HP/UX. More
[openssh.git] / openbsd-compat / bsd-misc.c
index f27788729bf2a6364aacee37db5dfb441acc674c..b52a6f52ee32bf650545005a9a8e5acdd81e2dae 100644 (file)
  */
 
 #include "includes.h"
+#include "xmalloc.h"
 
 RCSID("$Id$");
 
+/*
+ * 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
 }
 
This page took 0.231976 seconds and 4 git commands to generate.