Avoid reusing open file descriptor to make it easier to pinpoint Coverity CID 1164479 resource leak.
This commit is contained in:
parent
6ba8311144
commit
cc3a4e2f9e
11
src/init.c
11
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 ((fd = console_open(O_RDWR|O_NOCTTY)) < 0) {
|
||||
initlog(L_VB, "open(%s): %s", console_dev,
|
||||
strerror(errno));
|
||||
f = open("/dev/null", O_RDWR);
|
||||
fd = open("/dev/null", O_RDWR);
|
||||
}
|
||||
dup(f);
|
||||
dup(f);
|
||||
dup(fd);
|
||||
dup(fd);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user