Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Dec 2012 00:31:55 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r244331 - head/usr.sbin/gssd
Message-ID:  <201212170031.qBH0VtBZ082032@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Mon Dec 17 00:31:55 2012
New Revision: 244331
URL: http://svnweb.freebsd.org/changeset/base/244331

Log:
  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.
  
  Discussed with:	rwatson, jhb
  Tested by:	Illias A. Marinos, Herbert Poeckl
  MFC after:	2 weeks

Modified:
  head/usr.sbin/gssd/gssd.c

Modified: head/usr.sbin/gssd/gssd.c
==============================================================================
--- head/usr.sbin/gssd/gssd.c	Mon Dec 17 00:22:48 2012	(r244330)
+++ head/usr.sbin/gssd/gssd.c	Mon Dec 17 00:31:55 2012	(r244331)
@@ -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");
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212170031.qBH0VtBZ082032>