1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

device_id: close only opened dir

After more of opendir, make sure 'dir' is closed
only when it's been opened.
This commit is contained in:
Zdenek Kabelac 2024-10-24 23:26:53 +02:00
parent a5e3f0e6dd
commit edfa4955d8

View File

@ -1359,7 +1359,7 @@ static void devices_file_backup(struct cmd_context *cmd, char *fc, char *fb, tim
{
struct dirent *de;
struct dirent **namelist = NULL;
DIR *dir;
DIR *dir = NULL;
FILE *fp = NULL;
struct tm *tm;
char dirpath[PATH_MAX];
@ -1512,7 +1512,7 @@ out:
if (fp && fclose(fp))
stack;
if (closedir(dir))
if (dir && closedir(dir))
log_sys_debug("closedir", dirpath);
}