summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--openbsd-compat/setproctitle.c12
2 files changed, 11 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 41f1bb4b3..91e6ff030 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
120080403 120080403
2 - (djm) [openbsd-compat/bsd-poll.c] Include stdlib.h to avoid compile- 2 - (djm) [openbsd-compat/bsd-poll.c] Include stdlib.h to avoid compile-
3 time warnings on LynxOS. Patch from ops AT iki.fi 3 time warnings on LynxOS. Patch from ops AT iki.fi
4 - (djm) Force string arguments to replacement setproctitle() though
5 strnvis first. Ok dtucker@
4 6
520080403 720080403
6 - (djm) OpenBSD CVS sync: 8 - (djm) OpenBSD CVS sync:
@@ -3855,4 +3857,4 @@
3855 OpenServer 6 and add osr5bigcrypt support so when someone migrates 3857 OpenServer 6 and add osr5bigcrypt support so when someone migrates
3856 passwords between UnixWare and OpenServer they will still work. OK dtucker@ 3858 passwords between UnixWare and OpenServer they will still work. OK dtucker@
3857 3859
3858$Id: ChangeLog,v 1.4904 2008/04/04 05:16:35 djm Exp $ 3860$Id: ChangeLog,v 1.4905 2008/05/16 00:01:54 djm Exp $
diff --git a/openbsd-compat/setproctitle.c b/openbsd-compat/setproctitle.c
index b511f6649..2965f689e 100644
--- a/openbsd-compat/setproctitle.c
+++ b/openbsd-compat/setproctitle.c
@@ -43,6 +43,8 @@
43#endif 43#endif
44#include <string.h> 44#include <string.h>
45 45
46#include <vis.h>
47
46#define SPT_NONE 0 /* don't use it at all */ 48#define SPT_NONE 0 /* don't use it at all */
47#define SPT_PSTAT 1 /* use pstat(PSTAT_SETCMD, ...) */ 49#define SPT_PSTAT 1 /* use pstat(PSTAT_SETCMD, ...) */
48#define SPT_REUSEARGV 2 /* cover argv with title information */ 50#define SPT_REUSEARGV 2 /* cover argv with title information */
@@ -121,7 +123,7 @@ setproctitle(const char *fmt, ...)
121{ 123{
122#if SPT_TYPE != SPT_NONE 124#if SPT_TYPE != SPT_NONE
123 va_list ap; 125 va_list ap;
124 char buf[1024]; 126 char buf[1024], ptitle[1024];
125 size_t len; 127 size_t len;
126 extern char *__progname; 128 extern char *__progname;
127#if SPT_TYPE == SPT_PSTAT 129#if SPT_TYPE == SPT_PSTAT
@@ -142,14 +144,16 @@ setproctitle(const char *fmt, ...)
142 vsnprintf(buf + len, sizeof(buf) - len , fmt, ap); 144 vsnprintf(buf + len, sizeof(buf) - len , fmt, ap);
143 } 145 }
144 va_end(ap); 146 va_end(ap);
147 strnvis(ptitle, buf, sizeof(ptitle),
148 VIS_CSTYLE|VIS_NL|VIS_TAB|VIS_OCTAL);
145 149
146#if SPT_TYPE == SPT_PSTAT 150#if SPT_TYPE == SPT_PSTAT
147 pst.pst_command = buf; 151 pst.pst_command = ptitle;
148 pstat(PSTAT_SETCMD, pst, strlen(buf), 0, 0); 152 pstat(PSTAT_SETCMD, pst, strlen(ptitle), 0, 0);
149#elif SPT_TYPE == SPT_REUSEARGV 153#elif SPT_TYPE == SPT_REUSEARGV
150/* debug("setproctitle: copy \"%s\" into len %d", 154/* debug("setproctitle: copy \"%s\" into len %d",
151 buf, argv_env_len); */ 155 buf, argv_env_len); */
152 len = strlcpy(argv_start, buf, argv_env_len); 156 len = strlcpy(argv_start, ptitle, argv_env_len);
153 for(; len < argv_env_len; len++) 157 for(; len < argv_env_len; len++)
154 argv_start[len] = SPT_PADCHAR; 158 argv_start[len] = SPT_PADCHAR;
155#endif 159#endif