From mboxrd@z Thu Jan 1 00:00:00 1970 From: jeremie.galarneau@efficios.com (=?UTF-8?Q?J=C3=A9r=C3=A9mie_Galarneau?=) Date: Wed, 18 May 2016 22:57:48 -0400 Subject: [lttng-dev] [PATCH lttng-tools 01/10] Fix: bad file descriptors on close after rotation error In-Reply-To: <1463594659-10964-2-git-send-email-mathieu.desnoyers@efficios.com> References: <1463594659-10964-1-git-send-email-mathieu.desnoyers@efficios.com> <1463594659-10964-2-git-send-email-mathieu.desnoyers@efficios.com> Message-ID: Merged, thanks! Jérémie On Wed, May 18, 2016 at 2:04 PM, Mathieu Desnoyers wrote: > 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 > --- > src/common/utils.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/src/common/utils.c b/src/common/utils.c > index df55dc9..fdd8802 100644 > --- a/src/common/utils.c > +++ b/src/common/utils.c > @@ -850,6 +850,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.1.4 > -- Jérémie Galarneau EfficiOS Inc. http://www.efficios.com