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
This commit is contained in:
parent
0a16fa86cb
commit
765782e799
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=244331
@ -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");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user