From: David Teigland Date: Mon, 5 Feb 2024 19:15:37 +0000 (-0600) Subject: devices file: rename unused system.devices X-Git-Tag: v2_03_24~398 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=4f9215e70f0c2c589f6d2a4ff43459901ee7d93b;p=lvm2.git devices file: rename unused system.devices If lvm.conf has use_devicesfile=0 and /etc/lvm/device/system.devices exists, then rename it to system.devices-unused.YYYYMMDD.HHMMSS. This prevents an old, incorrect system.devices from being used in the future if lvm.conf is changed to use_devicesfile=1. --- diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c index d61185ff4..3e87ddc3a 100644 --- a/lib/device/dev-cache.c +++ b/lib/device/dev-cache.c @@ -29,6 +29,7 @@ #include #include #include +#include /* coverity[unnecessary_header] needed for MuslC */ #include @@ -1812,7 +1813,51 @@ static int _setup_devices_file_dmeventd(struct cmd_context *cmd) (void) dm_strncpy(cmd->devices_file_path, path, sizeof(cmd->devices_file_path)); return 1; } - + +/* + * When lvm.conf use_devicesfile=0, then an existing system.devices + * is renamed to system.devices-unused..