*** old/syslogd.c 1996/09/16 02:52:10 --- syslogd.c 1997/03/18 20:20:08 *************** *** 264,275 **** (void) alarm(TIMERINTVL); (void) unlink(LogName); bzero((char *)&sunx, sizeof(sunx)); sunx.sun_family = AF_UNIX; (void) strncpy(sunx.sun_path, LogName, sizeof sunx.sun_path); funix = socket(AF_UNIX, SOCK_DGRAM, 0); ! if (funix < 0 || bind(funix, (struct sockaddr *) &sunx, ! sizeof(sunx.sun_family) + strlen(sunx.sun_path)) < 0 || chmod(LogName, 0666) < 0) { (void) sprintf(line, "cannot create %s", LogName); logerror(line); --- 264,279 ---- (void) alarm(TIMERINTVL); (void) unlink(LogName); + #ifndef SUN_LEN + #define SUN_LEN(su) \ + (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path)) + #endif bzero((char *)&sunx, sizeof(sunx)); sunx.sun_family = AF_UNIX; (void) strncpy(sunx.sun_path, LogName, sizeof sunx.sun_path); funix = socket(AF_UNIX, SOCK_DGRAM, 0); ! if (funix < 0 || ! bind(funix, (struct sockaddr *) &sunx, SUN_LEN(&sunx)) < 0 || chmod(LogName, 0666) < 0) { (void) sprintf(line, "cannot create %s", LogName); logerror(line); *************** *** 481,487 **** int fac, prilev; int msglen; sigset_t block, oblock; ! struct sigaction act, oact; char *timestamp; time_t time(); --- 485,491 ---- int fac, prilev; int msglen; sigset_t block, oblock; ! struct sigaction hupact, alrmact, oact; char *timestamp; time_t time(); *************** *** 492,497 **** --- 496,505 ---- (void) sigemptyset(&block); (void) sigaddset(&block, SIGHUP); (void) sigaddset(&block, SIGALRM); + if (sigaction(SIGHUP, NULL, &hupact) < 0) + perror("sigaction"); + if (sigaction(SIGALRM, NULL, &alrmact) < 0) + perror("sigaction"); if (sigprocmask(SIG_BLOCK, &block, &oblock) < 0) perror("sigprocmask"); /* *************** *** 529,538 **** } (void) sigprocmask(SIG_SETMASK, &oblock, (sigset_t *) NULL); #ifdef SA_RESTART ! act.sa_flags = SA_RESTART; #endif ! (void) sigaction(SIGHUP, &act, &oact); ! (void) sigaction(SIGALRM, &act, &oact); return; } for (f = Files; f; f = f->f_next) { --- 537,547 ---- } (void) sigprocmask(SIG_SETMASK, &oblock, (sigset_t *) NULL); #ifdef SA_RESTART ! hupact.sa_flags = SA_RESTART; ! alrmact.sa_flags = SA_RESTART; #endif ! (void) sigaction(SIGHUP, &hupact, &oact); ! (void) sigaction(SIGALRM, &alrmact, &oact); return; } for (f = Files; f; f = f->f_next) { *************** *** 594,603 **** } (void) sigprocmask(SIG_SETMASK, &oblock, (sigset_t *) NULL); #ifdef SA_RESTART ! act.sa_flags = SA_RESTART; #endif ! (void) sigaction(SIGHUP, &act, &oact); ! (void) sigaction(SIGALRM, &act, &oact); } fprintlog(f, flags, msg) --- 603,613 ---- } (void) sigprocmask(SIG_SETMASK, &oblock, (sigset_t *) NULL); #ifdef SA_RESTART ! hupact.sa_flags = SA_RESTART; ! alrmact.sa_flags = SA_RESTART; #endif ! (void) sigaction(SIGHUP, &hupact, &oact); ! (void) sigaction(SIGALRM, &alrmact, &oact); } fprintlog(f, flags, msg)