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
This commit is contained in:
Mark Johnston 2015-02-13 18:32:55 +00:00
parent 37fd8bc2cb
commit 2f04825a18

View File

@ -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);