Module Name: src
Committed By: christos
Date: Sun Feb 18 16:58:51 UTC 2024
Modified Files:
src/usr.sbin/makefs: msdos.c
Log Message:
PR/57945: Jan-Benedict Glaw: makefs: msdos filesystems with label not
reproducible.
When we specify a label, the volume label is used to create the root dir
and it gets stamped by the timestamp. We were trying to set the timestamp
in the fs-specific part of the options parsing which did not work since
the method was called only for fs_specific options. Move setting of the
timestamp just before we create the fs, where we reconcile the rest of
the options.
To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/makefs/msdos.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/msdos.c
diff -u src/usr.sbin/makefs/msdos.c:1.23 src/usr.sbin/makefs/msdos.c:1.24
--- src/usr.sbin/makefs/msdos.c:1.23 Thu Dec 28 07:13:55 2023
+++ src/usr.sbin/makefs/msdos.c Sun Feb 18 11:58:51 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: msdos.c,v 1.23 2023/12/28 12:13:55 tsutsui Exp $ */
+/* $NetBSD: msdos.c,v 1.24 2024/02/18 16:58:51 christos Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: msdos.c,v 1.23 2023/12/28 12:13:55 tsutsui Exp $");
+__RCSID("$NetBSD: msdos.c,v 1.24 2024/02/18 16:58:51 christos Exp $");
#endif /* !__lint */
#include <sys/param.h>
@@ -121,7 +121,7 @@ msdos_parse_opts(const char *option, fsi
assert(msdos_opt != NULL);
if (debug & DEBUG_FS_PARSE_OPTS)
- printf("msdos_parse_opts: got `%s'\n", option);
+ printf("%s: got `%s'\n", __func__, option);
rv = set_option(msdos_options, option, NULL, 0);
if (rv == -1)
@@ -134,10 +134,6 @@ msdos_parse_opts(const char *option, fsi
else if (strcmp(msdos_options[rv].name, "hidden_sectors") == 0)
msdos_opt->hidden_sectors_set = 1;
- if (stampst.st_ino) {
- msdos_opt->timestamp_set = 1;
- msdos_opt->timestamp = stampst.st_mtime;
- }
return 1;
}
@@ -172,6 +168,10 @@ msdos_makefs(const char *image, const ch
"!= -o bytes_per_sector %u",
fsopts->sectorsize, msdos_opt->options.bytes_per_sector);
}
+ if (stampst.st_ino) {
+ msdos_opt->options.timestamp_set = 1;
+ msdos_opt->options.timestamp = stampst.st_mtime;
+ }
/* create image */
printf("Creating `%s'\n", image);