diff options
author | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2009-06-10 19:02:58 +0000 |
---|---|---|
committer | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2009-06-10 19:02:58 +0000 |
commit | 97c9a8d72271152cf71373b9c7fbdc6036b92e89 (patch) | |
tree | c5f3bf3b2358f9905597f0f258b244d38ce8d3c0 /scheduler/util.c | |
parent | 393ac6abae820d62982c8ad9c871f3c1cc59568c (diff) | |
download | cups-97c9a8d72271152cf71373b9c7fbdc6036b92e89.tar.gz |
Import changes from CUPS 1.4svn-r8704.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@1556 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'scheduler/util.c')
-rw-r--r-- | scheduler/util.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/scheduler/util.c b/scheduler/util.c index 48716d366..db920c225 100644 --- a/scheduler/util.c +++ b/scheduler/util.c @@ -282,7 +282,8 @@ cupsdPipeCommand(int *pid, /* O - Process ID or 0 on error */ char **argv, /* I - Arguments to pass to command */ int user) /* I - User to run as or 0 for current */ { - int fds[2]; /* Pipe file descriptors */ + int fd, /* Temporary file descriptor */ + fds[2]; /* Pipe file descriptors */ /* @@ -344,11 +345,14 @@ cupsdPipeCommand(int *pid, /* O - Process ID or 0 on error */ if (!getuid() && user) setuid(user); /* Run as restricted user */ - close(0); /* </dev/null */ - open("/dev/null", O_RDONLY); + if ((fd = open("/dev/null", O_RDONLY)) > 0) + { + dup2(fd, 0); /* </dev/null */ + close(fd); + } - close(1); /* >pipe */ - dup(fds[1]); + dup2(fds[1], 1); /* >pipe */ + close(fds[1]); cupsdExec(command, argv); exit(errno); |