diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2014-12-27 00:46:32 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2014-12-27 00:51:54 +0200 |
commit | cb8b9461907373485acabb90bc1cad5263abc8b8 (patch) | |
tree | 63c9a28993791d8b836685a6d01c608ba604e0d3 /lib/proctitle.c | |
parent | a1d8a2d3662cde5f1d0ec411e372c3614bb49a6d (diff) | |
download | pies-cb8b9461907373485acabb90bc1cad5263abc8b8.tar.gz pies-cb8b9461907373485acabb90bc1cad5263abc8b8.tar.bz2 |
Minor fixes.
* lib/proctitle.c (mf_proctitle_format): Check return from
vasprintf instead of checking the return pointer.
* src/inetd-bi.c: Check return values from write where reasonable.
* src/progman.c (redirect_to_file): Check return from chown.
(close_fds): Fix coredump (upper boundary was wrong).
(open_redirector, progman_dump_stats): Check return values.
* src/sysvinit.c (sysvinit_setenv): Remove unused variable.
* src/userprivs.c (str_eq, str_dispose): Remove unused functions.
* src/utmp.c: Check return values.
Diffstat (limited to 'lib/proctitle.c')
-rw-r--r-- | lib/proctitle.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/proctitle.c b/lib/proctitle.c index 2ec7d38..53f9fdc 100644 --- a/lib/proctitle.c +++ b/lib/proctitle.c @@ -139,22 +139,21 @@ void mf_proctitle_format (const char *fmt, ...) { va_list ap; - char *tmp = NULL; - + char *tmp; + int rc; if (!orig_argc) return; va_start (ap, fmt); - vasprintf (&tmp, fmt, ap); + rc = vasprintf (&tmp, fmt, ap); va_end (ap); - if (tmp) { + if (rc > 0) { free (proctitle_buffer); #if __FreeBSD__ >= 4 /* On FreeBSD the process name is prepended automatically */ proctitle_buffer = tmp; #else /* Otherwise we need to do that manually */ - asprintf (&proctitle_buffer, "%s: %s", __progname, tmp); - if (proctitle_buffer) + if (asprintf (&proctitle_buffer, "%s: %s", __progname, tmp) > 0) free (tmp); else proctitle_buffer = tmp; |