From: Jérémie Galarneau Date: Mon, 22 Aug 2022 15:25:21 +0000 (-0400) Subject: Fix: utils: unhandled close return value X-Git-Tag: v2.13.8~3 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=c6b1a4a69e5ed001cc0e3bec2191c18b9ee8612c;p=lttng-tools.git Fix: utils: unhandled close return value Signed-off-by: Jérémie Galarneau Change-Id: I3f932ac53e6b39c86babe726d5ec8e9ba999e561 --- diff --git a/src/common/utils.c b/src/common/utils.c index 682084c0f..bc4f6112f 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -240,7 +240,10 @@ int utils_create_pid_file(pid_t pid, const char *filepath) if (fp == NULL) { PERROR("fdopen file %s", filepath); ret = -1; - close(fd); + if (close(fd)) { + PERROR("Failed to close `%s` file descriptor while handling fdopen error", filepath); + } + goto error; }