diff options
author | markj <markj@FreeBSD.org> | 2015-02-13 18:32:55 +0000 |
---|---|---|
committer | markj <markj@FreeBSD.org> | 2015-02-13 18:32:55 +0000 |
commit | 795d3628536bb849d8a030ace31e6a5306a603ff (patch) | |
tree | 77381bb5b6d76eabab51110d4a1e0d3fb4db4884 /usr.sbin/gssd/gssd.c | |
parent | fcac47744db3b9611eece768036345acc7c9ff05 (diff) | |
download | FreeBSD-src-795d3628536bb849d8a030ace31e6a5306a603ff.zip FreeBSD-src-795d3628536bb849d8a030ace31e6a5306a603ff.tar.gz |
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
Diffstat (limited to 'usr.sbin/gssd/gssd.c')
-rw-r--r-- | usr.sbin/gssd/gssd.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/gssd/gssd.c b/usr.sbin/gssd/gssd.c index 9548b8c..2540161 100644 --- a/usr.sbin/gssd/gssd.c +++ b/usr.sbin/gssd/gssd.c @@ -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); |