[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] [PATCH] nbd-server: add setproctitle support



On Mon, Jun 25, 2012 at 03:08:06AM +0400, Dmitry V. Levin wrote:
> +#if USE_SETPROCTITLE
> +# ifdef HAVE_SETPROCTITLE_H
> +#  include <setproctitle.h>
> +# endif
> +#endif

This means <setproctitle.h> is only included if we have it, and the user
asked us to compile it in.

>  /** Default position of the config file */
>  #ifndef SYSCONFDIR
>  #define SYSCONFDIR "/etc"
> @@ -2249,6 +2255,9 @@ handle_connection(GArray *servers, int net, SERVER *serve, CLIENT *client)
>  
>  	msg4(LOG_INFO, "Starting to serve %s for %s",
>  	     client->exportname, client->clientname);
> +#if USE_SETPROCTITLE
> +	setproctitle("%s", client->clientname);
> +#endif

This means we try to compile it in if the user asked us to do so,
regardless of whether the header is available.

That's a bug waiting to happen.

Additionally, I'm not convinced we need a compile-time option for this.
What's your reason for doing it that way?

-- 
The volume of a pizza of thickness a and radius z can be described by
the following formula:

pi zz a



Reply to: