diff options
author | Petr Uzel | 2011-02-14 14:43:25 +0100 |
---|---|---|
committer | Karel Zak | 2011-02-16 16:07:15 +0100 |
commit | 20c04820d16673901ade8b344aa745d1d3a8876d (patch) | |
tree | 6e3e32d0c12f9fc4191efd5670b7ed8311ecda6b /shlibs | |
parent | libuuid: manpage spelling fixes (diff) | |
download | kernel-qcow2-util-linux-20c04820d16673901ade8b344aa745d1d3a8876d.tar.gz kernel-qcow2-util-linux-20c04820d16673901ade8b344aa745d1d3a8876d.tar.xz kernel-qcow2-util-linux-20c04820d16673901ade8b344aa745d1d3a8876d.zip |
libuuid: do not use invalid file descriptor
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Diffstat (limited to 'shlibs')
-rw-r--r-- | shlibs/uuid/src/gen_uuid.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/shlibs/uuid/src/gen_uuid.c b/shlibs/uuid/src/gen_uuid.c index a27d49c96..6e82a7b7c 100644 --- a/shlibs/uuid/src/gen_uuid.c +++ b/shlibs/uuid/src/gen_uuid.c @@ -324,10 +324,12 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low, state_fd = open("/var/lib/libuuid/clock.txt", O_RDWR|O_CREAT, 0660); (void) umask(save_umask); - state_f = fdopen(state_fd, "r+"); - if (!state_f) { - close(state_fd); - state_fd = -1; + if (state_fd != -1) { + state_f = fdopen(state_fd, "r+"); + if (!state_f) { + close(state_fd); + state_fd = -1; + } } } if (state_fd >= 0) { |