Date: Fri, 13 Feb 2015 18:32:56 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r278690 - head/usr.sbin/gssd Message-ID: <201502131832.t1DIWu65020185@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Fri Feb 13 18:32:55 2015 New Revision: 278690 URL: https://svnweb.freebsd.org/changeset/base/278690 Log: Check for an error from daemon(3), and correct the check for an error from socket(2). MFC after: 3 days Sponsored by: EMC / Isilon Storage Division Modified: head/usr.sbin/gssd/gssd.c Modified: head/usr.sbin/gssd/gssd.c ============================================================================== --- head/usr.sbin/gssd/gssd.c Fri Feb 13 18:16:08 2015 (r278689) +++ head/usr.sbin/gssd/gssd.c Fri Feb 13 18:32:55 2015 (r278690) @@ -193,7 +193,8 @@ main(int argc, char **argv) gssd_load_mech(); if (!debug_level) { - daemon(0, 0); + if (daemon(0, 0) != 0) + err(1, "Can't daemonize"); signal(SIGINT, SIG_IGN); signal(SIGQUIT, SIG_IGN); signal(SIGHUP, SIG_IGN); @@ -206,7 +207,7 @@ main(int argc, char **argv) strcpy(sun.sun_path, _PATH_GSSDSOCK); sun.sun_len = SUN_LEN(&sun); fd = socket(AF_LOCAL, SOCK_STREAM, 0); - if (!fd) { + if (fd < 0) { if (debug_level == 0) { syslog(LOG_ERR, "Can't create local gssd socket"); exit(1);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502131832.t1DIWu65020185>