Fix: utils: unhandled close return value
[lttng-tools.git] / src / common / utils.cpp
index 6c0fd261c7b8a4033d5eb35cc7247af509ddfca3..89ef0e54fd01714ea866c05dd2424cd1f21c26e5 100644 (file)
@@ -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;
        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;
        }
 
                goto error;
        }
 
This page took 0.022837 seconds and 4 git commands to generate.