mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
dmfilemapd: do not closdir(pid_d) unless it is open
This commit is contained in:
parent
d71071a1af
commit
481a522dd7
@ -151,7 +151,7 @@ static int _is_open_in_pid(pid_t pid, const char *path)
|
|||||||
if (dm_snprintf(path_buf, sizeof(path_buf),
|
if (dm_snprintf(path_buf, sizeof(path_buf),
|
||||||
DEFAULT_PROC_DIR "%d/fd", pid) < 0) {
|
DEFAULT_PROC_DIR "%d/fd", pid) < 0) {
|
||||||
log_error("Could not format pid path.");
|
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",
|
if (dm_snprintf(deleted_path, sizeof(deleted_path), "%s %s",
|
||||||
path, PROC_FD_DELETED_STR) < 0) {
|
path, PROC_FD_DELETED_STR) < 0) {
|
||||||
log_error("Could not format check path.");
|
log_error("Could not format check path.");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pid_d = opendir(path_buf);
|
pid_d = opendir(path_buf);
|
||||||
if (!pid_d) {
|
if (!pid_d) {
|
||||||
log_error("Could not open proc path: %s.", path_buf);
|
log_error("Could not open proc path: %s.", path_buf);
|
||||||
goto bad;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((pid_dp = readdir(pid_d)) != NULL) {
|
while ((pid_dp = readdir(pid_d)) != NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user