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.12.12~3 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4e15f915216d4956a31011eb10c26398f81adafa;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 7aed4442b..8b2e0063c 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; }