From: Mathieu Desnoyers Date: Wed, 18 May 2016 18:04:10 +0000 (-0400) Subject: Fix: bad file descriptors on close after rotation error X-Git-Tag: v2.6.3~22 X-Git-Url: https://git.liburcu.org/?p=lttng-tools.git;a=commitdiff_plain;h=b7d17fdfe9a0f52c272b4d2640a8e9b4b396ac1a Fix: bad file descriptors on close after rotation error 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 Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/utils.c b/src/common/utils.c index 3892cb4ad..46da97e56 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -793,6 +793,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) { /*