Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Jan 2013 23:09:16 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r245016 - stable/9/usr.sbin/gssd
Message-ID:  <201301032309.r03N9GF3003521@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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");
 	}
 



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