git.wh0rd.org
/
sysvinit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
013ce7c
)
Avoid reusing open file descriptor to make it easier to pinpoint Coverity CID 1164479...
author
Petter Reinholdtsen
<pere@hungry.com>
Fri, 7 Feb 2014 09:50:14 +0000
(09:50 +0000)
committer
Petter Reinholdtsen
<pere@hungry.com>
Fri, 7 Feb 2014 09:50:14 +0000
(09:50 +0000)
git-svn-id: svn://svn.sv.gnu.org/sysvinit/sysvinit/trunk@147
456724a4
-4300-0410-8514-
c89748c515a2
src/init.c
patch
|
blob
|
blame
|
history
diff --git
a/src/init.c
b/src/init.c
index 418755306708c99f1412ef95b94642879861bab3..2569a54018565b514b169ebbde3228cc70fa0b53 100644
(file)
--- a/
src/init.c
+++ b/
src/init.c
@@
-1170,15
+1170,16
@@
pid_t spawn(CHILD *ch, int *res)
/* Set ioctl settings to default ones */
console_stty();
- } else {
+ } else { /* parent */
+ int fd;
setsid();
- if ((f = console_open(O_RDWR|O_NOCTTY)) < 0) {
+ if ((f
d
= console_open(O_RDWR|O_NOCTTY)) < 0) {
initlog(L_VB, "open(%s): %s", console_dev,
strerror(errno));
- f = open("/dev/null", O_RDWR);
+ f
d
= open("/dev/null", O_RDWR);
}
- dup(f);
- dup(f);
+ dup(f
d
);
+ dup(f
d
);
}
/*