diff options
author | wpaul <wpaul@FreeBSD.org> | 1997-01-12 02:48:09 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 1997-01-12 02:48:09 +0000 |
commit | aa35c90f72beca1b6f791d672979f94e3281bc39 (patch) | |
tree | 97438af46c2d38b778f0ab0519bfc2606a55822e /usr.sbin/ypbind | |
parent | 54b96968b6dec7e1b3cbfa045f28dd9c4e0ecc45 (diff) | |
download | FreeBSD-src-aa35c90f72beca1b6f791d672979f94e3281bc39.zip FreeBSD-src-aa35c90f72beca1b6f791d672979f94e3281bc39.tar.gz |
- Save parent pid and check current pid against it upon entry to
terminate(). This makes doubly sure we don't trip the SIGTERM handler
in a child process. Suggested by: phk.
- It's int main(argc, argv), not void main(argc, argv), gosh darn it.
Diffstat (limited to 'usr.sbin/ypbind')
-rw-r--r-- | usr.sbin/ypbind/ypbind.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/ypbind/ypbind.c b/usr.sbin/ypbind/ypbind.c index ded22fb..26c76ec 100644 --- a/usr.sbin/ypbind/ypbind.c +++ b/usr.sbin/ypbind/ypbind.c @@ -112,6 +112,7 @@ static struct _dom_binding *broad_domain; #define YPSET_ALL 2 int ypsetmode = YPSET_NO; int ypsecuremode = 0; +int ppid; /* * Special restricted mode variables: when in restricted mode, only the @@ -349,6 +350,9 @@ int sig; struct _dom_binding *ypdb; char path[MAXPATHLEN]; + if (ppid != getpid()) + exit(0); + for(ypdb=ypbindlist; ypdb; ypdb=ypdb->dom_pnext) { close(ypdb->dom_lockfd); if (ypdb->dom_broadcast_pid) @@ -363,7 +367,7 @@ int sig; exit(0); } -void +int main(argc, argv) int argc; char **argv; @@ -466,6 +470,8 @@ char **argv; signal(SIGCHLD, reaper); signal(SIGTERM, terminate); + ppid = getpid(); /* Remember who we are. */ + openlog(argv[0], LOG_PID, LOG_DAEMON); /* Kick off the default domain */ @@ -497,6 +503,9 @@ char **argv; break; } } + + /* NOTREACHED */ + exit(1); } void |