summaryrefslogtreecommitdiff
path: root/openbsd-compat/setproctitle.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2014-02-10 00:27:24 +0000
committerColin Watson <cjwatson@debian.org>2014-02-10 02:40:28 +0000
commita2b8818c5d21cfcba443625251f691a2ea3a29c7 (patch)
tree8fe1fe448cde57eecf71a7bcd57186661b90313f /openbsd-compat/setproctitle.c
parentd399ecd8eb7d4aed3b7ba0d2727e619607fb901b (diff)
parentee8d8b97cc2c6081df3af453a228992b87309ec4 (diff)
Merge 6.5p1.
* New upstream release (http://www.openssh.com/txt/release-6.5, LP: #1275068): - ssh(1): Add support for client-side hostname canonicalisation using a set of DNS suffixes and rules in ssh_config(5). This allows unqualified names to be canonicalised to fully-qualified domain names to eliminate ambiguity when looking up keys in known_hosts or checking host certificate names (closes: #115286).
Diffstat (limited to 'openbsd-compat/setproctitle.c')
-rw-r--r--openbsd-compat/setproctitle.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/openbsd-compat/setproctitle.c b/openbsd-compat/setproctitle.c
index 2965f689e..9f7ca14c2 100644
--- a/openbsd-compat/setproctitle.c
+++ b/openbsd-compat/setproctitle.c
@@ -67,7 +67,8 @@ static size_t argv_env_len = 0;
67void 67void
68compat_init_setproctitle(int argc, char *argv[]) 68compat_init_setproctitle(int argc, char *argv[])
69{ 69{
70#if defined(SPT_TYPE) && SPT_TYPE == SPT_REUSEARGV 70#if !defined(HAVE_SETPROCTITLE) && \
71 defined(SPT_TYPE) && SPT_TYPE == SPT_REUSEARGV
71 extern char **environ; 72 extern char **environ;
72 char *lastargv = NULL; 73 char *lastargv = NULL;
73 char **envp = environ; 74 char **envp = environ;
@@ -125,6 +126,7 @@ setproctitle(const char *fmt, ...)
125 va_list ap; 126 va_list ap;
126 char buf[1024], ptitle[1024]; 127 char buf[1024], ptitle[1024];
127 size_t len; 128 size_t len;
129 int r;
128 extern char *__progname; 130 extern char *__progname;
129#if SPT_TYPE == SPT_PSTAT 131#if SPT_TYPE == SPT_PSTAT
130 union pstun pst; 132 union pstun pst;
@@ -137,13 +139,16 @@ setproctitle(const char *fmt, ...)
137 139
138 strlcpy(buf, __progname, sizeof(buf)); 140 strlcpy(buf, __progname, sizeof(buf));
139 141
142 r = -1;
140 va_start(ap, fmt); 143 va_start(ap, fmt);
141 if (fmt != NULL) { 144 if (fmt != NULL) {
142 len = strlcat(buf, ": ", sizeof(buf)); 145 len = strlcat(buf, ": ", sizeof(buf));
143 if (len < sizeof(buf)) 146 if (len < sizeof(buf))
144 vsnprintf(buf + len, sizeof(buf) - len , fmt, ap); 147 r = vsnprintf(buf + len, sizeof(buf) - len , fmt, ap);
145 } 148 }
146 va_end(ap); 149 va_end(ap);
150 if (r == -1 || (size_t)r >= sizeof(buf) - len)
151 return;
147 strnvis(ptitle, buf, sizeof(ptitle), 152 strnvis(ptitle, buf, sizeof(ptitle),
148 VIS_CSTYLE|VIS_NL|VIS_TAB|VIS_OCTAL); 153 VIS_CSTYLE|VIS_NL|VIS_TAB|VIS_OCTAL);
149 154