OSDN Git Service
(root)
/
android-x86
/
external-e2fsprogs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d9206a3
)
libuuid: Make sure fd's 0, 1, and 2 are valid before exec'ing uuidd
author
Theodore Ts'o
<tytso@mit.edu>
Mon, 29 Jun 2009 23:06:45 +0000
(19:06 -0400)
committer
Theodore Ts'o
<tytso@mit.edu>
Mon, 29 Jun 2009 23:06:45 +0000
(19:06 -0400)
When closing all of the file descriptors before starting uuidd, make
sure file descriptors 0, 1, and 2 are reserved by opening /dev/null.
This prevents strange bugs caused by assumptions regarding file
descriptors <= 2 as being special.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/uuid/gen_uuid.c
patch
|
blob
|
history
diff --git
a/lib/uuid/gen_uuid.c
b/lib/uuid/gen_uuid.c
index
b7a12ee
..
aa313ef
100644
(file)
--- a/
lib/uuid/gen_uuid.c
+++ b/
lib/uuid/gen_uuid.c
@@
-455,8
+455,11
@@
static void close_all_fds(void)
max = OPEN_MAX;
#endif
- for (i=0; i < max; i++)
+ for (i=0; i < max; i++)
{
close(i);
+ if (i <= 2)
+ open("/dev/null", O_RDWR);
+ }
}