Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-3]: src/usr.sbin/ypserv/ypserv Pull up revision 1.19 (requested b...



details:   https://anonhg.NetBSD.org/src/rev/4c8996fe4941
branches:  netbsd-3
changeset: 575786:4c8996fe4941
user:      tron <tron%NetBSD.org@localhost>
date:      Wed May 11 12:23:53 2005 +0000

description:
Pull up revision 1.19 (requested by chuck in ticket #281):
Use SA_NOCLDWAIT instead of catching the signal and waiting. Avoids signal
races the easy way.

diffstat:

 usr.sbin/ypserv/ypserv/ypserv.c |  26 ++++++++------------------
 1 files changed, 8 insertions(+), 18 deletions(-)

diffs (78 lines):

diff -r fe7d9f1234fe -r 4c8996fe4941 usr.sbin/ypserv/ypserv/ypserv.c
--- a/usr.sbin/ypserv/ypserv/ypserv.c   Wed May 11 12:22:16 2005 +0000
+++ b/usr.sbin/ypserv/ypserv/ypserv.c   Wed May 11 12:23:53 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ypserv.c,v 1.18 2002/07/06 00:42:27 wiz Exp $  */
+/*     $NetBSD: ypserv.c,v 1.18.6.1 2005/05/11 12:23:53 tron Exp $     */
 
 /*
  * Copyright (c) 1994 Mats O Jansson <moj%stacken.kth.se@localhost>
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ypserv.c,v 1.18 2002/07/06 00:42:27 wiz Exp $");
+__RCSID("$NetBSD: ypserv.c,v 1.18.6.1 2005/05/11 12:23:53 tron Exp $");
 #endif
 
 #include <sys/types.h>
@@ -84,9 +84,6 @@
 int    main(int, char *[]);
 void   usage(void);
 
-void   sighandler(int);
-
-
 static
 void _msgout(int level, const char *msg)
 {
@@ -276,12 +273,13 @@
        struct sigaction sa;
        int ch, xcreated = 0, one = 1;
 
+       setprogname(argv[0]);
+
 #ifdef LIBWRAP
 #define        GETOPTSTR       "dfl"
 #else
 #define        GETOPTSTR       "df"
 #endif
-
        while ((ch = getopt(argc, argv, GETOPTSTR)) != -1) {
                switch (ch) {
                case 'd':
@@ -339,8 +337,8 @@
 
        ypdb_init();    /* init db stuff */
 
-       sa.sa_handler = sighandler;
-       sa.sa_flags = 0;
+       sa.sa_handler = SIG_IGN;
+       sa.sa_flags = SA_NOCLDWAIT;
        if (sigemptyset(&sa.sa_mask)) {
                _msgout(LOG_ERR, "sigemptyset: %m");
                exit(1);
@@ -449,21 +447,13 @@
 }
 
 void
-sighandler(int sig)
-{
-
-       /* SIGCHLD */
-       while (wait3((int *)NULL, WNOHANG, (struct rusage *)NULL) > 0);
-}
-
-void
 usage(void)
 {
 
 #ifdef LIBWRAP
-#define        USAGESTR        "usage: %s [-d] [-l]\n"
+#define        USAGESTR        "Usage: %s [-d] [-l]\n"
 #else
-#define        USAGESTR        "usage: %s [-d]\n"
+#define        USAGESTR        "Usage: %s [-d]\n"
 #endif
 
        fprintf(stderr, USAGESTR, getprogname());



Home | Main Index | Thread Index | Old Index