Module Name:    src
Committed By:   christos
Date:           Mon Dec 21 03:19:17 UTC 2015

Modified Files:
        src/usr.sbin/makefs: cd9660.c

Log Message:
Fix some more MKREPRO issues in cdrom creation. Now amd64 passes MKREPRO.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/makefs/cd9660.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makefs/cd9660.c
diff -u src/usr.sbin/makefs/cd9660.c:1.50 src/usr.sbin/makefs/cd9660.c:1.51
--- src/usr.sbin/makefs/cd9660.c:1.50	Tue Nov 24 19:48:49 2015
+++ src/usr.sbin/makefs/cd9660.c	Sun Dec 20 22:19:17 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660.c,v 1.50 2015/11/25 00:48:49 christos Exp $	*/
+/*	$NetBSD: cd9660.c,v 1.51 2015/12/21 03:19:17 christos Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -103,7 +103,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: cd9660.c,v 1.50 2015/11/25 00:48:49 christos Exp $");
+__RCSID("$NetBSD: cd9660.c,v 1.51 2015/12/21 03:19:17 christos Exp $");
 #endif  /* !__lint */
 
 #include <string.h>
@@ -483,7 +483,7 @@ cd9660_parse_opts(const char *option, fs
  */
 void
 cd9660_makefs(const char *image, const char *dir, fsnode *root,
-	      fsinfo_t *fsopts)
+    fsinfo_t *fsopts)
 {
 	int64_t startoffset;
 	int numDirectories;
@@ -661,7 +661,7 @@ typedef int (*cd9660node_func)(cd9660nod
 static void
 cd9660_finalize_PVD(iso9660_disk *diskStructure)
 {
-	time_t tim;
+	time_t tstamp = stampst.st_ino ? stampst.st_mtime : time(NULL);
 
 	/* root should be a fixed size of 34 bytes since it has no name */
 	memcpy(diskStructure->primaryDescriptor.root_directory_record,
@@ -710,23 +710,23 @@ cd9660_finalize_PVD(iso9660_disk *diskSt
 		diskStructure->primaryDescriptor.bibliographic_file_id, 37);
 
 	/* Setup dates */
-	time(&tim);
 	cd9660_time_8426(
 	    (unsigned char *)diskStructure->primaryDescriptor.creation_date,
-	    tim);
+	    tstamp);
 	cd9660_time_8426(
 	    (unsigned char *)diskStructure->primaryDescriptor.modification_date,
-	    tim);
+	    tstamp);
 
-	/*
-	cd9660_set_date(diskStructure->primaryDescriptor.expiration_date, now);
-	*/
+#if 0
+	cd9660_set_date(diskStructure->primaryDescriptor.expiration_date,
+	    tstamp);
+#endif
 	memset(diskStructure->primaryDescriptor.expiration_date, '0' ,16);
 	diskStructure->primaryDescriptor.expiration_date[16] = 0;
 
 	cd9660_time_8426(
 	    (unsigned char *)diskStructure->primaryDescriptor.effective_date,
-	    tim);
+	    tstamp);
 }
 
 static void
@@ -821,7 +821,7 @@ cd9660_fill_extended_attribute_record(cd
 static int
 cd9660_translate_node_common(iso9660_disk *diskStructure, cd9660node *newnode)
 {
-	time_t tim;
+	time_t tstamp = stampst.st_ino ? stampst.st_mtime : time(NULL);
 	u_char flag;
 	char temp[ISO_FILENAME_MAXLENGTH_WITH_PADDING];
 
@@ -841,9 +841,8 @@ cd9660_translate_node_common(iso9660_dis
 	/* Set the various dates */
 
 	/* If we want to use the current date and time */
-	time(&tim);
 
-	cd9660_time_915(newnode->isoDirRecord->date, tim);
+	cd9660_time_915(newnode->isoDirRecord->date, tstamp);
 
 	cd9660_bothendian_dword(newnode->fileDataLength,
 	    newnode->isoDirRecord->size);
@@ -883,7 +882,8 @@ cd9660_translate_node(iso9660_disk *disk
 		return 0;
 
 	/* Finally, overwrite some of the values that are set by default */
-	cd9660_time_915(newnode->isoDirRecord->date, node->inode->st.st_mtime);
+	cd9660_time_915(newnode->isoDirRecord->date,
+	    stampst.st_ino ? stampst.st_mtime : node->inode->st.st_mtime);
 
 	return 1;
 }

Reply via email to