From: Ion Badulescu Date: Sat, 28 Dec 2002 22:28:56 +0000 (+0000) Subject: * configure.in: increase library patchlevel X-Git-Tag: am-utils-6_1b2~20 X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=9ac7740871bfce49dcaab6ba4bca6670f713bf11;p=am-utils-6.0.git * configure.in: increase library patchlevel * libamu/xutil.c (amu_release_controlling_tty): close and reopen file descriptors 0,1,2 before calling setsid() --- diff --git a/ChangeLog b/ChangeLog index d3db028..c537a31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-12-28 Ion Badulescu + + * configure.in: increase library patchlevel + + * libamu/xutil.c (amu_release_controlling_tty): close and reopen + file descriptors 0,1,2 before calling setsid() + 2002-12-27 Erez Zadok * updated copyright year to 2003 on all files diff --git a/configure.in b/configure.in index e3d5158..84da508 100644 --- a/configure.in +++ b/configure.in @@ -53,7 +53,7 @@ AH_BOTTOM([ dnl dnl AC_CONFIG_AUX_DIR(m4) AC_PREREQ(2.52) -AC_REVISION($Revision: 1.44 $) +AC_REVISION($Revision: 1.45 $) AC_COPYRIGHT([Copyright (c) 1997-2003 Erez Zadok]) dnl find out system type AC_MSG_NOTICE(*** SYSTEM TYPES ***) @@ -90,7 +90,7 @@ dnl last version info was 4.1.2 (am-utils-6.0.4) dnl dnl We increase the minor number for am-utils-6.1, because it has a new API dnl (get_server_pid) but can be used without problems by am-utils-6.0.3+. -LIBTOOL_LDFLAGS="-version-info 5:2:3" +LIBTOOL_LDFLAGS="-version-info 5:3:3" AC_SUBST(LIBTOOL_LDFLAGS) dnl ====================================================================== diff --git a/libamu/xutil.c b/libamu/xutil.c index 19e16de..92084ef 100644 --- a/libamu/xutil.c +++ b/libamu/xutil.c @@ -37,7 +37,7 @@ * SUCH DAMAGE. * * - * $Id: xutil.c,v 1.28 2002/12/27 22:44:11 ezk Exp $ + * $Id: xutil.c,v 1.29 2002/12/28 22:28:57 ib42 Exp $ * */ @@ -881,24 +881,14 @@ amu_release_controlling_tty(void) #endif /* TIOCNOTTY */ int tempfd; -#ifdef HAVE_SETSID - /* XXX: one day maybe use vhangup(2) */ - if (setsid() < 0) { - plog(XLOG_WARNING, "Could not release controlling tty using setsid(): %m"); - } else { - plog(XLOG_INFO, "released controlling tty using setsid()"); - return; - } -#endif /* HAVE_SETSID */ - /* * In daemon mode, leaving open file descriptors to terminals or pipes * can be a really bad idea. * Case in point: the redhat startup script calls us through their 'initlog' - * program, which exits as soon as the original amd process exits. If, at some - * point, a misbehaved library function decides to print something to the screen, - * we get a SIGPIPE and die. - * More precisely: NIS libc functions will attempt to print to stderr + * program, which exits as soon as the original amd process exits. If, + * at some point, a misbehaved library function decides to print something + * to the screen, we get a SIGPIPE and die. + * And guess what: NIS glibc functions will attempt to print to stderr * "YPBINDPROC_DOMAIN: Domain not bound" if ypbind is running but can't find * a ypserver. * @@ -913,6 +903,16 @@ amu_release_controlling_tty(void) fflush(stderr); close(2); dup2(tempfd, 2); close(tempfd); +#ifdef HAVE_SETSID + /* XXX: one day maybe use vhangup(2) */ + if (setsid() < 0) { + plog(XLOG_WARNING, "Could not release controlling tty using setsid(): %m"); + } else { + plog(XLOG_INFO, "released controlling tty using setsid()"); + return; + } +#endif /* HAVE_SETSID */ + #ifdef TIOCNOTTY fd = open("/dev/tty", O_RDWR); if (fd < 0) {