From 0e45d3083900e5a33e1ab6a08dce546a9269f932 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Fri, 13 Mar 2015 01:07:43 -0400 Subject: [PATCH] Fix: Check stream fd value before closing MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- formats/ctf/ir/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/formats/ctf/ir/stream.c b/formats/ctf/ir/stream.c index 70e2ec2a..858cd98b 100644 --- a/formats/ctf/ir/stream.c +++ b/formats/ctf/ir/stream.c @@ -913,7 +913,7 @@ void bt_ctf_stream_destroy(struct bt_ctf_ref *ref) stream = container_of(ref, struct bt_ctf_stream, ref_count); ctf_fini_pos(&stream->pos); - if (close(stream->pos.fd)) { + if (stream->pos.fd >= 0 && close(stream->pos.fd)) { perror("close"); } -- 2.34.1