From bb81e23e176ec7dfe0111b5aa2946a51239ef3b9 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sun, 30 Dec 2001 01:46:38 +0000 Subject: When running interactive we want to set our own process group for signal management. Jeremy. (This used to be commit fffae94dd5699f44c0b1c8081587deafd89b3fc0) --- source3/configure | 4 ++-- source3/configure.in | 2 +- source3/include/config.h.in | 5 ++++- source3/nmbd/nmbd.c | 9 +++++++++ source3/nsswitch/winbindd.c | 9 +++++++++ source3/smbd/server.c | 9 +++++++++ 6 files changed, 34 insertions(+), 4 deletions(-) (limited to 'source3') diff --git a/source3/configure b/source3/configure index 63fc4a4965..10a497669d 100755 --- a/source3/configure +++ b/source3/configure @@ -945,7 +945,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -for ac_prog in mawk gawk nawk awk +for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -5191,7 +5191,7 @@ else fi done -for ac_func in fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat +for ac_func in fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:5198: checking for $ac_func" >&5 diff --git a/source3/configure.in b/source3/configure.in index f38854efa4..059936e0a4 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -554,7 +554,7 @@ else fi AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown fchown chmod fchmod chroot) -AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat) +AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid) AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid) AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent) AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf) diff --git a/source3/include/config.h.in b/source3/include/config.h.in index 1c22c0b5e5..f85de1b1af 100644 --- a/source3/include/config.h.in +++ b/source3/include/config.h.in @@ -1,4 +1,4 @@ -/* include/config.h.in. Generated automatically from configure.in by autoheader 2.13. */ +/* include/config.h.in. Generated automatically from configure.in by autoheader. */ /* Define if on AIX 3. System headers sometimes define this. @@ -695,6 +695,9 @@ /* Define if you have the setnetgrent function. */ #undef HAVE_SETNETGRENT +/* Define if you have the setpgid function. */ +#undef HAVE_SETPGID + /* Define if you have the setpriv function. */ #undef HAVE_SETPRIV diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 29b6c0347a..b2ff81675a 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -803,6 +803,15 @@ static void usage(char *pname) become_daemon(); } +#if HAVE_SETPGID + /* + * If we're interactive we want to set our own process group for + * signal management. + */ + if (opt_interactive) + setpgid( (pid_t)0, (pid_t)0 ); +#endif + #ifndef SYNC_DNS /* Setup the async dns. We do it here so it doesn't have all the other stuff initialised and thus chewing memory and sockets */ diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index 9bbd88653c..a877bf9e0a 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -822,6 +822,15 @@ int main(int argc, char **argv) if (!interactive) become_daemon(); +#if HAVE_SETPGID + /* + * If we're interactive we want to set our own process group for + * signal management. + */ + if (interactive) + setpgid( (pid_t)0, (pid_t)0); +#endif + load_interfaces(); secrets_init(); diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 403ed12c40..101d49c144 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -785,6 +785,15 @@ static void usage(char *pname) become_daemon(); } +#if HAVE_SETPGID + /* + * If we're interactive we want to set our own process group for + * signal management. + */ + if (interactive) + setpgid( (pid_t)0, (pid_t)0); +#endif + if (!directory_exist(lp_lockdir(), NULL)) { mkdir(lp_lockdir(), 0755); } -- cgit