svn commit: r245016 - stable/9/usr.sbin/gssd

Rick Macklem rmacklem at FreeBSD.org
Thu Jan 3 23:09:17 UTC 2013


Author: rmacklem
Date: Thu Jan  3 23:09:16 2013
New Revision: 245016
URL: http://svnweb.freebsd.org/changeset/base/245016

Log:
  MFC: r244331
  Fix the gssd daemon so that it uses syslog() to report
  an error instead of calling err() when it is daemonized,
  so that the error gets logged.

Modified:
  stable/9/usr.sbin/gssd/gssd.c
Directory Properties:
  stable/9/usr.sbin/gssd/   (props changed)

Modified: stable/9/usr.sbin/gssd/gssd.c
==============================================================================
--- stable/9/usr.sbin/gssd/gssd.c	Thu Jan  3 22:27:57 2013	(r245015)
+++ stable/9/usr.sbin/gssd/gssd.c	Thu Jan  3 23:09:16 2013	(r245016)
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/linker.h>
 #include <sys/module.h>
 #include <sys/queue.h>
+#include <sys/syslog.h>
 #include <ctype.h>
 #include <err.h>
 #include <pwd.h>
@@ -106,21 +107,43 @@ main(int argc, char **argv)
 	sun.sun_len = SUN_LEN(&sun);
 	fd = socket(AF_LOCAL, SOCK_STREAM, 0);
 	if (!fd) {
+		if (debug_level == 0) {
+			syslog(LOG_ERR, "Can't create local gssd socket");
+			exit(1);
+		}
 		err(1, "Can't create local gssd socket");
 	}
 	oldmask = umask(S_IXUSR|S_IRWXG|S_IRWXO);
 	if (bind(fd, (struct sockaddr *) &sun, sun.sun_len) < 0) {
+		if (debug_level == 0) {
+			syslog(LOG_ERR, "Can't bind local gssd socket");
+			exit(1);
+		}
 		err(1, "Can't bind local gssd socket");
 	}
 	umask(oldmask);
 	if (listen(fd, SOMAXCONN) < 0) {
+		if (debug_level == 0) {
+			syslog(LOG_ERR, "Can't listen on local gssd socket");
+			exit(1);
+		}
 		err(1, "Can't listen on local gssd socket");
 	}
 	xprt = svc_vc_create(fd, RPC_MAXDATASIZE, RPC_MAXDATASIZE);
 	if (!xprt) {
+		if (debug_level == 0) {
+			syslog(LOG_ERR,
+			    "Can't create transport for local gssd socket");
+			exit(1);
+		}
 		err(1, "Can't create transport for local gssd socket");
 	}
 	if (!svc_reg(xprt, GSSD, GSSDVERS, gssd_1, NULL)) {
+		if (debug_level == 0) {
+			syslog(LOG_ERR,
+			    "Can't register service for local gssd socket");
+			exit(1);
+		}
 		err(1, "Can't register service for local gssd socket");
 	}
 


More information about the svn-src-stable-9 mailing list