Fix: bad file descriptors on close after rotation error
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 18 May 2016 18:04:10 +0000 (14:04 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 20 May 2016 19:17:51 +0000 (15:17 -0400)
Ensure we don't try to close output stream file descriptors twice when a
trace file rotation error occurs (once at tracefile rotation, once when
closing the stream). Set the fd value to -1 after the first close to
ensure we don't try to close it again.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/utils.c

index 217d8c65d070a22ac3a0265cf63fbba1dc0a0e3f..2473ca39ef24b755fa6054ea4c1eb9abf2c9a2eb 100644 (file)
@@ -836,6 +836,7 @@ int utils_rotate_stream_file(char *path_name, char *file_name, uint64_t size,
                PERROR("Closing tracefile");
                goto error;
        }
+       *stream_fd = -1;
 
        if (count > 0) {
                /*
This page took 0.025327 seconds and 4 git commands to generate.