]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Added process title hack support for OS X.
authorTimo Sirainen <tss@iki.fi>
Thu, 20 May 2010 15:16:39 +0000 (17:16 +0200)
committerTimo Sirainen <tss@iki.fi>
Thu, 20 May 2010 15:16:39 +0000 (17:16 +0200)
--HG--
branch : HEAD

configure.in
src/lib/process-title.c

index 9e211740e0c85186a07cc3a262bc0f0bf9a208bc..09224fe7ee69766359bf5cb6491229cc5da42931 100644 (file)
@@ -633,7 +633,7 @@ case "$host_os" in
                LIBS="-lxnet $LIBS"
                AC_DEFINE(PREAD_BROKEN,, Defint if pread/pwrite implementation is broken)
                ;;
-       linux*)
+       linux*|darwin*)
                AC_DEFINE(PROCTITLE_HACK,, Define if process title can be changed by modifying argv)
                ;;
        *)
index 9417c306548135f0a66248e263b7ee1ce1187703..ee7a933196a64084951ac4fb3a5edfed017e90a6 100644 (file)
@@ -89,11 +89,13 @@ static void proctitle_hack_set(const char *title)
 {
        size_t len = strlen(title);
 
-       if (len >= process_title_len)
-               len = process_title_len - 1;
+       /* OS X wants two NULs */
+       if (len >= process_title_len-1)
+               len = process_title_len - 2;
 
        memcpy(process_title, title, len);
        process_title[len++] = '\0';
+       process_title[len++] = '\0';
 
        if (len < process_title_clean_pos) {
                memset(process_title + len, PROCTITLE_CLEAR_CHAR,