diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-08-13 15:01:40 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-08-13 15:01:40 +0100 |
commit | 7a1cfea11cf27eea852be68b2373b233e650f689 (patch) | |
tree | 06df8d7d1f707a9120a8a61b3fd164d430230e98 /src/libutil/util.c | |
parent | 28afb066ad6c30fdd251f83fbcf8c94429049663 (diff) | |
download | rspamd-7a1cfea11cf27eea852be68b2373b233e650f689.tar.gz rspamd-7a1cfea11cf27eea852be68b2373b233e650f689.zip |
Fix setproctitle for osx and solaris.
Diffstat (limited to 'src/libutil/util.c')
-rw-r--r-- | src/libutil/util.c | 17 |
1 files changed, 17 insertions, 0 deletions
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 } /* |