Path: utzoo!attcan!uunet!mcvax!hp4nl!tnosoes!tom From: tom@tnosoes.UUCP (Tom Vijlbrief) Newsgroups: comp.sources.d Subject: Re: "monthd" doesn't terminate Keywords: month, exit, ultrix 1.2 Message-ID: <416@tnosoes.UUCP> Date: 21 Nov 88 14:18:34 GMT References: <1252@leah.Albany.Edu> Organization: TNO Institute for Perception, Soesterberg, The Netherlands Lines: 84 I posted a buggy fix for the not terminating monthd :-( . return(kill(parent_pid, 0) == ESRCH);/* Parent is gone */ instead of return(kill(parent_pid, 0) < 0 && errno == ESRCH);/* Parent is gone */ This one should work... ================================================================= Here is a diff that fixes this problem. (Monthd not terminating). It also sets the correct group owner on the .month file. This is necessary for BSD systems, because files have the same group owner as their directory when they are created. Sys-V sets the group owner to the effective groupid. Tom =============================================================================== Tom Vijlbrief TNO Institute for Perception P.O. Box 23 Phone: +31 34 63 62 77 3769 DE Soesterberg E-mail: tnosoes!tom@mcvax.cwi.nl The Netherlands or: uunet!mcvax!tnosoes!tom =============================================================================== *** org/read_sched.c Mon Nov 14 11:34:55 1988 --- read_sched.c Fri Nov 18 09:29:14 1988 *************** *** 48,54 **** if (read_mode == READ_ONLY) fd = open(schedule_file_name, O_RDONLY); else { ! if ((fd = open(schedule_file_name, O_RDWR|O_CREAT, 0660)) != -1) #if LOCKF if (lockf(fd, F_TLOCK, 0L) == -1) { close(fd); --- 48,55 ---- if (read_mode == READ_ONLY) fd = open(schedule_file_name, O_RDONLY); else { ! if ((fd = open(schedule_file_name, O_RDWR|O_CREAT, 0660)) != -1) { ! fchown(fd, -1, getegid()); #if LOCKF if (lockf(fd, F_TLOCK, 0L) == -1) { close(fd); *************** *** 64,69 **** --- 65,71 ---- } #endif FLOCK #endif LOCKF + } } #else fd = open(schedule_file_name, O_RDWR|O_CREAT, 0660); *** org/monthd.c Thu Nov 17 10:27:35 1988 --- monthd.c Thu Nov 17 16:46:16 1988 *************** *** 6,11 **** --- 6,12 ---- #include #include #include + #include #include "month.h" short dhour, dminute, dsecond; *************** *** 222,228 **** --- 223,232 ---- #if SYS5 return(getpgrp() == 0); /* pgrp is 0 after logout */ #else + #if 0 return(getpgrp(0) == 0);/* pgrp is 0 after logout */ + #else + return(kill(parent_pid, 0) < 0 && errno == ESRCH);/* Parent is gone */ #endif #endif }