From 481a522dd76baaa36b9e903dcd23d66be0b6754a Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Wed, 29 Mar 2017 16:48:32 +0100 Subject: [PATCH] dmfilemapd: do not closdir(pid_d) unless it is open --- daemons/dmfilemapd/dmfilemapd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/daemons/dmfilemapd/dmfilemapd.c b/daemons/dmfilemapd/dmfilemapd.c index 391003e8d..dec74ec4b 100644 --- a/daemons/dmfilemapd/dmfilemapd.c +++ b/daemons/dmfilemapd/dmfilemapd.c @@ -151,7 +151,7 @@ static int _is_open_in_pid(pid_t pid, const char *path) if (dm_snprintf(path_buf, sizeof(path_buf), DEFAULT_PROC_DIR "%d/fd", pid) < 0) { log_error("Could not format pid path."); - goto bad; + return 0; } /* @@ -160,12 +160,13 @@ static int _is_open_in_pid(pid_t pid, const char *path) if (dm_snprintf(deleted_path, sizeof(deleted_path), "%s %s", path, PROC_FD_DELETED_STR) < 0) { log_error("Could not format check path."); + return 0; } pid_d = opendir(path_buf); if (!pid_d) { log_error("Could not open proc path: %s.", path_buf); - goto bad; + return 0; } while ((pid_dp = readdir(pid_d)) != NULL) { -- 2.43.5