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

cov: check for strftime result

This commit is contained in:
Zdenek Kabelac 2024-03-25 13:20:54 +01:00
parent 3b47ce0a37
commit 46e013988f

View File

@ -1846,7 +1846,9 @@ static void devices_file_rename_unused(struct cmd_context *cmd)
t = time(NULL); t = time(NULL);
if (!(tm = localtime(&t))) if (!(tm = localtime(&t)))
return; return;
strftime(datetime_str, sizeof(datetime_str), "%Y%m%d.%H%M%S", tm);
if (!strftime(datetime_str, sizeof(datetime_str), "%Y%m%d.%H%M%S", tm))
return;
if (dm_snprintf(path2, sizeof(path2), "%s/devices/%s-unused.%s", cmd->system_dir, filename, datetime_str) < 0) if (dm_snprintf(path2, sizeof(path2), "%s/devices/%s-unused.%s", cmd->system_dir, filename, datetime_str) < 0)
return; return;