aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2000-01-21 04:57:36 +0000
committerBill Nottingham <notting@redhat.com>2000-01-21 04:57:36 +0000
commitb27ab3341373fbc35d0239e520732b1cc57c8b6b (patch)
tree2fa3e9fb46fc6ea286e054d153fa946810a1390f /src/process.c
parent2f9439e3df69681302ce1d6707f5034db8ecf002 (diff)
downloadinitscripts-b27ab3341373fbc35d0239e520732b1cc57c8b6b.tar
initscripts-b27ab3341373fbc35d0239e520732b1cc57c8b6b.tar.gz
initscripts-b27ab3341373fbc35d0239e520732b1cc57c8b6b.tar.bz2
initscripts-b27ab3341373fbc35d0239e520732b1cc57c8b6b.tar.xz
initscripts-b27ab3341373fbc35d0239e520732b1cc57c8b6b.zip
take out some pointless code
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/process.c b/src/process.c
index acdb5a35..174cc58e 100644
--- a/src/process.c
+++ b/src/process.c
@@ -22,7 +22,7 @@ extern regex_t **regList;
int forkCommand(char **args, int *outfd, int *errfd, int *cmdfd, int quiet) {
/* Fork command 'cmd', returning pid, and optionally pointer
* to open file descriptor fd */
- int fdin, fdout, fderr, fdcmd, pid;
+ int fdout, fderr, fdcmd, pid;
int outpipe[2], errpipe[2], fdpipe[2];
int ourpid;
@@ -45,9 +45,13 @@ int forkCommand(char **args, int *outfd, int *errfd, int *cmdfd, int quiet) {
if (!quiet)
fderr=dup(2);
}
- fdcmd = fdpipe[1];
- if (cmdfd)
- *cmdfd = fdpipe[0];
+
+ if (cmdfd) {
+ *cmdfd = fdpipe[0];
+ fdcmd = fdpipe[1];
+ } else {
+ fdcmd = open("/dev/null",O_WRONLY);
+ }
ourpid = getpid();
if ((pid = fork())==-1) {
perror("fork");
@@ -58,7 +62,6 @@ int forkCommand(char **args, int *outfd, int *errfd, int *cmdfd, int quiet) {
* fucks up and we segfault or something, we don't kill rc.sysinit. */
if ( (cmdfd&&!pid) || (pid &&!cmdfd)) {
/* parent */
- close(fdin);
close(fdout);
close(fderr);
close(fdcmd);