[908] in Zephyr_Bugs
possibly more useful patch for zwgc to get HUP on logout
daemon@ATHENA.MIT.EDU (Derrick J Brashear)
Tue Feb 17 14:31:48 1998
Date: Tue, 17 Feb 1998 14:31:43 -0500 (EST)
From: Derrick J Brashear <shadow@DEMENTIA.ORG>
Reply-To: Derrick J Brashear <shadow@DEMENTIA.ORG>
To: zephyr-bugs@MIT.EDU
---559023410-758783491-887743903=:14554
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
It still doesn't fix all of our problems, but this patch seems to cause zwgc to
do a better job of dying when it should. Requires configure tests for the
additional functions, which I can provide if needed.
-D
---559023410-758783491-887743903=:14554
Content-Type: TEXT/plain; CHARSET=US-ASCII
Content-Description: zpatch2
*** /afs/athena.mit.edu/astaff/project/zephyr/src/clients/zwgc/main.c Wed Apr 3 17:49:20 1996
--- /afs/andrew/system/src/local/zephyr/047/zephyr-2.0.2//clients/zwgc//main.c Tue Feb 17 14:26:23 1998
***************
*** 440,453 ****
{
/* detach from terminal and fork. */
register int i;
/* to try to get SIGHUP on user logout */
! #if defined(_POSIX_VERSION) && !defined(ultrix)
! (void) setpgid(0, tcgetpgrp(1));
#else
! (void) setpgrp(0, getpgrp(getppid()));
#endif
/* fork off and let parent exit... */
if (i = fork()) {
if (i < 0) {
--- 556,599 ----
{
/* detach from terminal and fork. */
register int i;
+ int pgrp,npgrp;
/* to try to get SIGHUP on user logout */
! #if defined(HAVE_GETSID)
! npgrp=getsid(0);
#else
! #if defined HAVE_TCGETPGRP
! #ifdef GETPGRP_VOID
! pgrp=getpgrp();
! #else
! pgrp=getpgrp(0);
#endif
+ #endif
+ if (tcgetpgrp(1) != pgrp)
+ npgrp=tcgetpgrp(1);
+ else
+ #endif
+ #ifdef HAVE_GETPGID
+ npgrp=getpgid(getppid());
+ #else
+ #ifdef HAVE_GETPGRP2
+ npgrp=getpgrp2(getppid()); /* This only exists under HPUX */
+ #else
+ #ifndef GETPGRP_VOID
+ npgrp=getpgrp(getppid());
+ #else
+ /* This system can't do it */
+ npgrp=pgrp;
+ #endif
+ #endif
+ #endif
+ #if defined HAVE_SETPGID
+ (void) setpgid(0, npgrp);
+ #else
+ (void) setpgrp(0, npgrp);
+ #endif
+
/* fork off and let parent exit... */
if (i = fork()) {
if (i < 0) {
---559023410-758783491-887743903=:14554--