diff options
author | Roy Marples <roy@marples.name> | 2009-04-18 19:54:04 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2009-04-18 19:54:04 +0000 |
commit | 3579663173be18becb5f4ddadf859e5984eab660 (patch) | |
tree | 92b3d9b1b63f3fb7a67578b7d50b73ad21eba183 /src/rc/rc-misc.c | |
parent | 802fe9709ec9e2e5887e87e1047c15d90020472f (diff) |
Don't leak the lock fd.
Diffstat (limited to 'src/rc/rc-misc.c')
-rw-r--r-- | src/rc/rc-misc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c index 5ebd1ddc..f86f1773 100644 --- a/src/rc/rc-misc.c +++ b/src/rc/rc-misc.c @@ -351,11 +351,13 @@ exec_service(const char *service, const char *arg) _exit(EXIT_FAILURE); } - if (pid == -1) + if (pid == -1) { fprintf(stderr, "fork: %s\n",strerror (errno)); + svc_unlock(basename_c(service), fd); + } else + fcntl(fd, F_SETFD, fcntl(fd, F_GETFD, 0) | FD_CLOEXEC); sigprocmask(SIG_SETMASK, &old, NULL); - free(file); return pid; } |