Fix: utils: unhandled close return value
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 22 Aug 2022 15:25:21 +0000 (11:25 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 22 Aug 2022 15:26:48 +0000 (11:26 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I3f932ac53e6b39c86babe726d5ec8e9ba999e561

src/common/utils.c

index 682084c0f67d0cf32eb39bb2c9e76a5975a0f559..bc4f6112f9db4907e18dd9758f2a39105ca0a138 100644 (file)
@@ -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;
        }
 
This page took 0.026529 seconds and 4 git commands to generate.