← Commit list

611729eff

Denys Vlasenko
Denys Vlasenko
2023-04-10
SUCCESS Duration: 156s

Subject

mkfs_vfat: do not generate same volume_id when run in rapid succession

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

util-linux/mkfs_vfat.c+3 -2
@@ -267,8 +267,9 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
// cache device name
device_name = argv[0];
- // default volume ID = creation time
- volume_id = time(NULL);
+ // default volume ID: somewhat random (not crypto-strong)
+ // (mix in pid to avoid same IDs when run in rapid succession)
+ volume_id = time(NULL) ^ getpid();
// truncate to exactly 11 chars, pad with spaces
sprintf(volume_label11, "%-11.11s", arg_volume_label);