mirror of git://anongit.mindrot.org/openssh.git
- (djm) Force string arguments to replacement setproctitle() though
strnvis first. Ok dtucker@
This commit is contained in:
parent
55754fb002
commit
c5750226af
|
@ -1,6 +1,8 @@
|
||||||
20080403
|
20080403
|
||||||
- (djm) [openbsd-compat/bsd-poll.c] Include stdlib.h to avoid compile-
|
- (djm) [openbsd-compat/bsd-poll.c] Include stdlib.h to avoid compile-
|
||||||
time warnings on LynxOS. Patch from ops AT iki.fi
|
time warnings on LynxOS. Patch from ops AT iki.fi
|
||||||
|
- (djm) Force string arguments to replacement setproctitle() though
|
||||||
|
strnvis first. Ok dtucker@
|
||||||
|
|
||||||
20080403
|
20080403
|
||||||
- (djm) OpenBSD CVS sync:
|
- (djm) OpenBSD CVS sync:
|
||||||
|
@ -3855,4 +3857,4 @@
|
||||||
OpenServer 6 and add osr5bigcrypt support so when someone migrates
|
OpenServer 6 and add osr5bigcrypt support so when someone migrates
|
||||||
passwords between UnixWare and OpenServer they will still work. OK dtucker@
|
passwords between UnixWare and OpenServer they will still work. OK dtucker@
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.4904 2008/04/04 05:16:35 djm Exp $
|
$Id: ChangeLog,v 1.4905 2008/05/16 00:01:54 djm Exp $
|
||||||
|
|
|
@ -43,6 +43,8 @@
|
||||||
#endif
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <vis.h>
|
||||||
|
|
||||||
#define SPT_NONE 0 /* don't use it at all */
|
#define SPT_NONE 0 /* don't use it at all */
|
||||||
#define SPT_PSTAT 1 /* use pstat(PSTAT_SETCMD, ...) */
|
#define SPT_PSTAT 1 /* use pstat(PSTAT_SETCMD, ...) */
|
||||||
#define SPT_REUSEARGV 2 /* cover argv with title information */
|
#define SPT_REUSEARGV 2 /* cover argv with title information */
|
||||||
|
@ -121,7 +123,7 @@ setproctitle(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
#if SPT_TYPE != SPT_NONE
|
#if SPT_TYPE != SPT_NONE
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char buf[1024];
|
char buf[1024], ptitle[1024];
|
||||||
size_t len;
|
size_t len;
|
||||||
extern char *__progname;
|
extern char *__progname;
|
||||||
#if SPT_TYPE == SPT_PSTAT
|
#if SPT_TYPE == SPT_PSTAT
|
||||||
|
@ -142,14 +144,16 @@ setproctitle(const char *fmt, ...)
|
||||||
vsnprintf(buf + len, sizeof(buf) - len , fmt, ap);
|
vsnprintf(buf + len, sizeof(buf) - len , fmt, ap);
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
strnvis(ptitle, buf, sizeof(ptitle),
|
||||||
|
VIS_CSTYLE|VIS_NL|VIS_TAB|VIS_OCTAL);
|
||||||
|
|
||||||
#if SPT_TYPE == SPT_PSTAT
|
#if SPT_TYPE == SPT_PSTAT
|
||||||
pst.pst_command = buf;
|
pst.pst_command = ptitle;
|
||||||
pstat(PSTAT_SETCMD, pst, strlen(buf), 0, 0);
|
pstat(PSTAT_SETCMD, pst, strlen(ptitle), 0, 0);
|
||||||
#elif SPT_TYPE == SPT_REUSEARGV
|
#elif SPT_TYPE == SPT_REUSEARGV
|
||||||
/* debug("setproctitle: copy \"%s\" into len %d",
|
/* debug("setproctitle: copy \"%s\" into len %d",
|
||||||
buf, argv_env_len); */
|
buf, argv_env_len); */
|
||||||
len = strlcpy(argv_start, buf, argv_env_len);
|
len = strlcpy(argv_start, ptitle, argv_env_len);
|
||||||
for(; len < argv_env_len; len++)
|
for(; len < argv_env_len; len++)
|
||||||
argv_start[len] = SPT_PADCHAR;
|
argv_start[len] = SPT_PADCHAR;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue