mkfs_vfat: do not generate same volume_id when run in rapid succession
function old new delta mkfs_vfat_main 1502 1523 +21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
9bc2b6e884
commit
611729eff3
1 changed files with 3 additions and 2 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue