Module Name: src
Committed By: reinoud
Date: Fri Jan 2 21:01:12 UTC 2015
Modified Files:
src/sbin/newfs_udf: udf_write.c
Log Message:
Fix volumesetname to comply to UDF 2.01 [2.2.2.5]
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sbin/newfs_udf/udf_write.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/newfs_udf/udf_write.c
diff -u src/sbin/newfs_udf/udf_write.c:1.8 src/sbin/newfs_udf/udf_write.c:1.9
--- src/sbin/newfs_udf/udf_write.c:1.8 Sun Aug 25 14:13:47 2013
+++ src/sbin/newfs_udf/udf_write.c Fri Jan 2 21:01:12 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_write.c,v 1.8 2013/08/25 14:13:47 reinoud Exp $ */
+/* $NetBSD: udf_write.c,v 1.9 2015/01/02 21:01:12 reinoud Exp $ */
/*
* Copyright (c) 2006, 2008, 2013 Reinoud Zandijk
@@ -30,7 +30,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: udf_write.c,v 1.8 2013/08/25 14:13:47 reinoud Exp $");
+__RCSID("$NetBSD: udf_write.c,v 1.9 2015/01/02 21:01:12 reinoud Exp $");
#include <stdio.h>
#include <stdlib.h>
@@ -317,6 +317,7 @@ udf_derive_format(int req_enable, int re
int
udf_proces_names(void)
{
+ struct timeval time_of_day;
uint32_t primary_nr;
uint64_t volset_nr;
@@ -335,8 +336,9 @@ udf_proces_names(void)
if (mmc_discinfo.disc_flags & MMC_DFLAGS_BARCODEVALID) {
volset_nr = mmc_discinfo.disc_barcode;
} else {
- volset_nr = (uint32_t) random();
- volset_nr |= ((uint64_t) random()) << 32;
+ (void)gettimeofday(&time_of_day, NULL);
+ volset_nr = (uint64_t) random();
+ volset_nr |= ((uint64_t) time_of_day.tv_sec) << 32;
}
context.volset_name = calloc(128,1);
sprintf(context.volset_name, "%016"PRIx64, volset_nr);