[nsd-users] patch for nsd using hardcoded name "nsd"

Paul Wouters paul at xelerance.com
Wed Jul 15 22:56:05 UTC 2009


I am using two nsd instances to run two different nameservers on the
same machine. Since both need to have proper initscript support, I
have made a hardlink under a different name to /usr/sbin/nsd, and
initscripts can use my new name "nsdhm", and do things like "pidof nsdhm".

I got very confused when my i saw "nsd" started to fail, and it took
me a while to figure out it was my nsdhm that had failed to start.

Attached patch changes some of the log entries to use argv[0] instead
of the string "nsd" for logging.

-------------- next part --------------
diff -Naur nsd-3.2.2/nsd.c nsd-3.2.2.new/nsd.c
--- nsd-3.2.2/nsd.c	2009-05-18 09:17:47.000000000 -0400
+++ nsd-3.2.2.new/nsd.c	2009-07-15 16:51:03.112382117 -0400
@@ -810,8 +810,8 @@
 	} else {
 		if (kill(oldpid, 0) == 0 || errno == EPERM) {
-				"nsd is already running as %u, continuing",
-				(unsigned) oldpid);
+				"%s is already running as %u, continuing",
+				argv[0], (unsigned) oldpid);
 		} else {
 				"...stale pid file from process %u",
@@ -880,12 +880,12 @@
 	/* Run the server... */
 	if (server_init(&nsd) != 0) {
-		log_msg(LOG_ERR, "server initialization failed, nsd could "
-						 "not be started");
+		log_msg(LOG_ERR, "server initialization failed, %s could "
+				 "not be started",argv[0]);
-	log_msg(LOG_NOTICE, "nsd started (%s), pid %d", PACKAGE_STRING,
+	log_msg(LOG_NOTICE, "%s started (%s), pid %d", argv[0],  PACKAGE_STRING,
 		(int) nsd.pid);
 	if (nsd.server_kind == NSD_SERVER_MAIN) {

More information about the nsd-users mailing list