projects
/
platform
/
upstream
/
kbd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9d987aa
)
Fix race condition
author
Alexey Gladkov
<legion@altlinux.org>
Mon, 19 Feb 2007 07:47:49 +0000
(10:47 +0300)
committer
Alexey Gladkov
<legion@altlinux.org>
Mon, 19 Feb 2007 07:47:49 +0000
(10:47 +0300)
Open stdin, stdout, stderr in /dev/null if they are not opened.
Signed-off-by: Alexey Gladkov <legion@altlinux.org>
openvt/openvt.c
patch
|
blob
|
history
diff --git
a/openvt/openvt.c
b/openvt/openvt.c
index
99f174e
..
b830a4d
100644
(file)
--- a/
openvt/openvt.c
+++ b/
openvt/openvt.c
@@
-39,7
+39,7
@@
int
main(int argc, char *argv[])
{
- int opt, pid;
+ int opt, pid
, i
;
struct vt_stat vtstat;
int vtno = -1;
int fd0 = -1;
@@
-105,6
+105,12
@@
main(int argc, char *argv[])
}
}
+ for (i=0; i<3; i++) {
+ struct stat st;
+ if (fstat(i, &st) == -1 && open("/dev/null", O_RDWR) == -1)
+ error(EXIT_FAILURE, errno, "open");
+ }
+
consfd = getfd(NULL);
if (consfd < 0) {
fprintf(stderr,