Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/rtadvd Don't start another copy of rtadvd if one is...



details:   https://anonhg.NetBSD.org/src/rev/0a449efca49e
branches:  trunk
changeset: 826542:0a449efca49e
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Sep 11 14:12:28 2017 +0000

description:
Don't start another copy of rtadvd if one is running.

diffstat:

 usr.sbin/rtadvd/rtadvd.c |  15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diffs (29 lines):

diff -r 8a33c93e9f07 -r 0a449efca49e usr.sbin/rtadvd/rtadvd.c
--- a/usr.sbin/rtadvd/rtadvd.c  Mon Sep 11 14:12:07 2017 +0000
+++ b/usr.sbin/rtadvd/rtadvd.c  Mon Sep 11 14:12:28 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtadvd.c,v 1.54 2017/09/11 14:12:07 christos Exp $     */
+/*     $NetBSD: rtadvd.c,v 1.55 2017/09/11 14:12:28 christos Exp $     */
 /*     $KAME: rtadvd.c,v 1.92 2005/10/17 14:40:02 suz Exp $    */
 
 /*
@@ -265,10 +265,15 @@
 
 #ifdef __NetBSD__
        /* record the current PID */
-       if (pidfile(pidfilepath) < 0) {
-               syslog(LOG_ERR,
-                   "<%s> failed to open the pid log file, run anyway.",
-                   __func__);
+       if (pidfile(pidfilepath) == -1) {
+               if (errno == EEXIST) {
+                       syslog(LOG_ERR, "Another instance of `%s' is running "
+                           "(pid %d); exiting.", getprogname(),
+                           pidfile_read(pidfilepath));
+                       return EXIT_FAILURE;
+               }
+               syslog(LOG_ERR, "Failed to open the pid log file `%s' (%m), "
+                   "run anyway.", pidfilepath);
        }
 #endif
 



Home | Main Index | Thread Index | Old Index