os: Leave stdin and stdout open
There's no reason to close these now that we don't care what file descriptors we use. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
parent
8217c29d2d
commit
f0275b1e5a
11
os/osinit.c
11
os/osinit.c
|
@ -224,17 +224,6 @@ OsInit(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(XQUARTZ) /* STDIN is already /dev/null and STDOUT/STDERR is managed by console_redirect.c */
|
#if !defined(XQUARTZ) /* STDIN is already /dev/null and STDOUT/STDERR is managed by console_redirect.c */
|
||||||
# if defined(__APPLE__)
|
|
||||||
int devnullfd = open(devnull, O_RDWR, 0);
|
|
||||||
assert(devnullfd > 2);
|
|
||||||
|
|
||||||
dup2(devnullfd, STDIN_FILENO);
|
|
||||||
dup2(devnullfd, STDOUT_FILENO);
|
|
||||||
close(devnullfd);
|
|
||||||
# elif !defined(__CYGWIN__)
|
|
||||||
fclose(stdin);
|
|
||||||
fclose(stdout);
|
|
||||||
# endif
|
|
||||||
/*
|
/*
|
||||||
* If a write of zero bytes to stderr returns non-zero, i.e. -1,
|
* If a write of zero bytes to stderr returns non-zero, i.e. -1,
|
||||||
* then writing to stderr failed, and we'll write somewhere else
|
* then writing to stderr failed, and we'll write somewhere else
|
||||||
|
|
Loading…
Reference in New Issue
Block a user