X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-daemon%2Fsetproctitle.c;h=09b7f65f75b96845f5bcaaab9df5fc548a650dcd;hb=90d30bec8d880fb44c0869fd8285543101b7cf60;hp=f8d3ddbc94fd11df31cf6f446bdf5f3933dd4716;hpb=270ea0a81dacf6a2073019d232b6f106e33eeb14;p=catta diff --git a/avahi-daemon/setproctitle.c b/avahi-daemon/setproctitle.c index f8d3ddb..09b7f65 100644 --- a/avahi-daemon/setproctitle.c +++ b/avahi-daemon/setproctitle.c @@ -29,6 +29,10 @@ #include #include +#ifdef HAVE_SYS_PRCTL_H +#include +#endif + #include #include "setproctitle.h" @@ -73,7 +77,7 @@ void avahi_init_proc_title(int argc, char **argv) { #endif } -void avahi_set_proc_title(const char *fmt,...) { +void avahi_set_proc_title(const char *name, const char *fmt,...) { #ifdef HAVE_SETPROCTITLE char t[256]; @@ -99,4 +103,11 @@ void avahi_set_proc_title(const char *fmt,...) { memset(argv_buffer[0] + l, 0, argv_size - l); argv_buffer[1] = NULL; #endif + +#if defined(HAVE_SYS_PRCTL_H) && defined(PR_SET_NAME) + + if (name) + prctl(PR_SET_NAME, (unsigned long) name, 0, 0, 0); + +#endif }