From: Jérémie Galarneau Date: Mon, 22 Aug 2022 15:25:21 +0000 (-0400) Subject: Fix: utils: unhandled close return value X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=9a30ba1da4e6d59eb30c6535a9dd04cd599e6fae;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.cpp b/src/common/utils.cpp index 6c0fd261c..89ef0e54f 100644 --- a/src/common/utils.cpp +++ b/src/common/utils.cpp @@ -228,7 +228,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; }