steve@gec-mi-at.co.uk (Steve Lademann) (11/22/88)
Problem: The monthd program distributed as part of the calendar/appointment reminder system, month, has a couple of problems when used with BSD4.3. First, it doesn't print the reminder message on the terminal, and second, it doesn't exit when you log out. Fix: Apply the following patches:- *** monthd.c.old Mon Nov 21 15:32:18 1988 --- monthd.c Tue Nov 22 12:33:34 1988 *************** *** 24,32 **** --- 24,36 ---- struct event_rec events = {{0, 0, 0}, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0}, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, {0, 0}, 0, 0, 0, 0, 0, {0, 0, 0}, 0}; + /* Place to store original login */ + char ologin[20]; + extern char *get_home_dir(); extern alarm_t alarm(); extern unsigned short getuid(); + extern char *getlogin(); main(argc, argv) int argc; *************** *** 34,39 **** --- 38,44 ---- { int sig_terminate(); + strcpy(ologin, getlogin()); prog_name = argv[0]; user_id = (int) getuid(); parent_pid = getppid(); *************** *** 45,51 **** */ month_dir = get_home_dir(user_id); check_args(argc, argv); ! close(0); close(1); close(2); /* close stdin, stdout, stderr */ if (fork() == 0) { signal(SIGHUP, sig_terminate); /* child process */ signal(SIGTERM, sig_terminate); --- 50,56 ---- */ month_dir = get_home_dir(user_id); check_args(argc, argv); ! /* close(0); close(1); close(2); /* close stdin, stdout, stderr */ if (fork() == 0) { signal(SIGHUP, sig_terminate); /* child process */ signal(SIGTERM, sig_terminate); *************** *** 212,217 **** --- 217,223 ---- } fprintf(tty, ". \r\n\007"); + fflush(tty); } logged_out() *************** *** 222,228 **** #if SYS5 return(getpgrp() == 0); /* pgrp is 0 after logout */ #else ! return(getpgrp(0) == 0);/* pgrp is 0 after logout */ #endif } --- 228,237 ---- #if SYS5 return(getpgrp() == 0); /* pgrp is 0 after logout */ #else ! /* return(getpgrp(0) == 0);/* pgrp is 0 after logout */ ! /* OH NO IT ISN'T - at least not on BSD4.3 steve@gec-mi-at.co.uk */ ! return(strcmp(ologin, getlogin())); /* Compare current and old login */ ! #endif } Steve Lademann |Phone: 44 727 59292 x4326 Marconi Instruments Ltd |UUCP : ...mcvax!ukc!hrc63!miduet!steve St. Albans AL4 0JN | : ...mcvax!ukc!root44!miduet!steve Herts. UK |NRS : steve@uk.co.gec-mi-at