Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/blacklist/bin create the pid file after we daem...



details:   https://anonhg.NetBSD.org/src/rev/3937a42abea0
branches:  trunk
changeset: 335750:3937a42abea0
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jan 22 20:17:34 2015 +0000

description:
create the pid file after we daemonize

diffstat:

 external/bsd/blacklist/bin/blacklistd.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (41 lines):

diff -r 81f4a9f125f3 -r 3937a42abea0 external/bsd/blacklist/bin/blacklistd.c
--- a/external/bsd/blacklist/bin/blacklistd.c   Thu Jan 22 20:11:33 2015 +0000
+++ b/external/bsd/blacklist/bin/blacklistd.c   Thu Jan 22 20:17:34 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: blacklistd.c,v 1.21 2015/01/22 16:19:53 christos Exp $ */
+/*     $NetBSD: blacklistd.c,v 1.22 2015/01/22 20:17:34 christos Exp $ */
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "config.h"
 #endif
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: blacklistd.c,v 1.21 2015/01/22 16:19:53 christos Exp $");
+__RCSID("$NetBSD: blacklistd.c,v 1.22 2015/01/22 20:17:34 christos Exp $");
 
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -322,8 +322,6 @@
                if (tout == 0)
                        tout = 5000;
        } else {
-               if (pidfile(getprogname()) == -1)
-                       err(EXIT_FAILURE, "Can't create pidfile");
                if (tout == 0)
                        tout = 15000;
        }
@@ -359,9 +357,12 @@
        if (state == NULL)
                return EXIT_FAILURE;
 
-       if (!debug)
+       if (!debug) {
                if (daemon(0, 0) == -1)
                        err(EXIT_FAILURE, "daemon failed");
+               if (pidfile(NULL) == -1)
+                       err(EXIT_FAILURE, "Can't create pidfile");
+       }
 
        while (!done) {
                if (rconf) {



Home | Main Index | Thread Index | Old Index