aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/proctitle.c11
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;

Return to:

Send suggestions and report system problems to the System administrator.