[git commit] mkfs_vfat: do not generate same volume_id when run in rapid succession
Denys Vlasenko
vda.linux at googlemail.com
Mon Apr 10 12:47:38 UTC 2023
commit: https://git.busybox.net/busybox/commit/?id=611729eff386234b09d40780cdcc21fe72f6f8b8
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
function old new delta
mkfs_vfat_main 1502 1523 +21
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
util-linux/mkfs_vfat.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c
index 821371953..d2db78e1d 100644
--- a/util-linux/mkfs_vfat.c
+++ b/util-linux/mkfs_vfat.c
@@ -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);
More information about the busybox-cvs
mailing list