1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s4:smbd: call setproctitle_init

Call setproctitle_init() in main which suppresses the
  "samba: setproctitle not initialized, please either call
   setproctitle_init() or link against libbsd-ctor."
messages, but more importantly it displays meaningful details in ps
output.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=9816

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Gary Lockyer 2017-09-14 09:36:21 +12:00 committed by Andrew Bartlett
parent 25b9e06f4a
commit 4f84b6dfa8
4 changed files with 13 additions and 0 deletions

View File

@ -942,3 +942,8 @@ void rep_setproctitle(const char *fmt, ...)
{
}
#endif
#ifndef HAVE_SETPROCTITLE_INIT
void rep_setproctitle_init(int argc, char *argv[], char *envp[])
{
}
#endif

View File

@ -918,6 +918,10 @@ int usleep(useconds_t);
void rep_setproctitle(const char *fmt, ...) PRINTF_ATTRIBUTE(1, 2);
#endif
#ifndef HAVE_SETPROCTITLE_INIT
#define setproctitle_init rep_setproctitle_init
void rep_setproctitle_init(int argc, char *argv[], char *envp[]);
#endif
bool nss_wrapper_enabled(void);
bool nss_wrapper_hosts_enabled(void);
bool socket_wrapper_enabled(void);

View File

@ -271,6 +271,8 @@ def configure(conf):
conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h')
if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'):
conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h')
if not conf.CHECK_FUNCS('setproctitle_init'):
conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h')
if not conf.CHECK_FUNCS('closefrom'):
conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h')

View File

@ -631,5 +631,7 @@ static int binary_smbd_main(const char *binary_name,
int main(int argc, const char *argv[])
{
setproctitle_init(argc, discard_const(argv), environ);
return binary_smbd_main("samba", argc, argv);
}