mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-30 17:18:21 +03:00
devicesfile: move opendir after fclose
Call opendir() after new file is stored within dir,
otherwise this new file would not accounted.
(cherry picked from commit 2c5bf25187
)
This commit is contained in:
parent
2371383de6
commit
d6229041a5
@ -1399,11 +1399,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);
|
||||
|
||||
@ -1437,6 +1432,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