From 7a1cfea11cf27eea852be68b2373b233e650f689 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 13 Aug 2015 15:01:40 +0100 Subject: Fix setproctitle for osx and solaris. --- src/libutil/util.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/libutil/util.c b/src/libutil/util.c index 6e7acdf55..055b6b0ff 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -662,13 +662,29 @@ rspamd_pass_signal (GHashTable * workers, gint signo) #ifndef HAVE_SETPROCTITLE +#if !defined(DARWIN) && !defined(SOLARIS) && !defined(__APPLE__) static gchar *title_buffer = 0; static size_t title_buffer_size = 0; static gchar *title_progname, *title_progname_full; +#endif gint setproctitle (const gchar *fmt, ...) { +#if defined(DARWIN) || defined(SOLARIS) || defined(__APPLE__) + GString *dest; + va_list ap; + + dest = g_string_new (""); + va_start (ap, fmt); + rspamd_vprintf_gstring (dest, fmt, ap); + va_end (ap); + + g_set_prgname (dest->str); + g_string_free (dest, TRUE); + + return 0; +#else if (!title_buffer || !title_buffer_size) { errno = ENOMEM; return -1; @@ -711,6 +727,7 @@ setproctitle (const gchar *fmt, ...) memset (title_buffer + written, '\0', title_buffer_size - written); return 0; +#endif } /* -- cgit v1.2.3