X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=blobdiff_plain;f=data%2FPVE%2FTools.pm;h=7448183455f5a1c2e23bdccfc9fdffa0adaa0872;hp=f8e9c4773dbe94ed7e57d1c9de5102d96410b85e;hb=a345b9d584c60ec3535270062e105fc05a94d24b;hpb=2f13cbb5a6557da77c644e112c09d797066496ea diff --git a/data/PVE/Tools.pm b/data/PVE/Tools.pm index f8e9c47..7448183 100644 --- a/data/PVE/Tools.pm +++ b/data/PVE/Tools.pm @@ -882,7 +882,9 @@ sub decode_utf8_parameters { sub random_ether_addr { - my $rand = Digest::SHA::sha1_hex(rand(), time()); + my ($seconds, $microseconds) = gettimeofday; + + my $rand = Digest::SHA::sha1_hex($$, rand(), $seconds, $microseconds); my $mac = ''; for (my $i = 0; $i < 6; $i++) { @@ -996,4 +998,12 @@ sub dir_glob_foreach { } } +sub assert_if_modified { + my ($digest1, $digest2) = @_; + + if ($digest1 && $digest2 && ($digest1 ne $digest2)) { + die "detected modified configuration - file change by other user? Try again.\n"; + } +} + 1;