From b5b0c181b9f47edd4be6fd1f70835f232c0d56fd Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 18 May 2016 14:04:10 -0400 Subject: [PATCH] Fix: bad file descriptors on close after rotation error MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/common/utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/utils.c b/src/common/utils.c index 901ddb036..1e52ae0aa 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -854,6 +854,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) { /* -- 2.34.1