summaryrefslogtreecommitdiff
path: root/src/rc/rc-misc.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-04-18 19:54:04 +0000
committerRoy Marples <roy@marples.name>2009-04-18 19:54:04 +0000
commit3579663173be18becb5f4ddadf859e5984eab660 (patch)
tree92b3d9b1b63f3fb7a67578b7d50b73ad21eba183 /src/rc/rc-misc.c
parent802fe9709ec9e2e5887e87e1047c15d90020472f (diff)
downloadopenrc-3579663173be18becb5f4ddadf859e5984eab660.tar.gz
openrc-3579663173be18becb5f4ddadf859e5984eab660.tar.bz2
openrc-3579663173be18becb5f4ddadf859e5984eab660.tar.xz
Don't leak the lock fd.
Diffstat (limited to 'src/rc/rc-misc.c')
-rw-r--r--src/rc/rc-misc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c
index 5ebd1dd..f86f177 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;
}