From 9a30ba1da4e6d59eb30c6535a9dd04cd599e6fae Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Mon, 22 Aug 2022 11:25:21 -0400 Subject: [PATCH] Fix: utils: unhandled close return value MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau Change-Id: I3f932ac53e6b39c86babe726d5ec8e9ba999e561 --- src/common/utils.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; } -- 2.34.1