mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
devicesfile: move opendir after fclose
Call opendir() after new file is stored within dir, otherwise this new file would not accounted.
This commit is contained in:
parent
b88cbc7f17
commit
2c5bf25187
@ -1389,11 +1389,6 @@ static void devices_file_backup(struct cmd_context *cmd, char *fc, char *fb, tim
|
||||
stack;
|
||||
return;
|
||||
}
|
||||
if (!(dir = opendir(dirpath))) {
|
||||
log_sys_debug("opendir", dirpath);
|
||||
return;
|
||||
}
|
||||
|
||||
tm = localtime(tp);
|
||||
strftime(datetime_str, sizeof(datetime_str), "%Y%m%d.%H%M%S", tm);
|
||||
|
||||
@ -1427,6 +1422,12 @@ static void devices_file_backup(struct cmd_context *cmd, char *fc, char *fb, tim
|
||||
fp = NULL;
|
||||
log_debug("Wrote backup %s", path);
|
||||
|
||||
/* Open dir after backup file is written, so it can be accounted */
|
||||
if (!(dir = opendir(dirpath))) {
|
||||
log_sys_debug("opendir", dirpath);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Possibly remove old backup files per configurable limit on backup files. */
|
||||
|
||||
while ((de = readdir(dir))) {
|
||||
|
Loading…
Reference in New Issue
Block a user