The branch main has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=c6030b380469f928c8cae87ed53bcb234cb3486f

commit c6030b380469f928c8cae87ed53bcb234cb3486f
Author:     Ed Maste <ema...@freebsd.org>
AuthorDate: 2024-06-17 17:03:44 +0000
Commit:     Ed Maste <ema...@freebsd.org>
CommitDate: 2024-06-17 17:04:40 +0000

    Revert "tzsetup: ask local/UTC question only on x86"
    
    I am unsure if AArch64 Windows systems keep UTC or local time in the RTC
    by default, so keep tzsetup consistent across architectures for now.
    
    This reverts commit aa6fb1d277be47c51abc309ac9305def0fce7f9d.
    
    Reported by:     Mark Millard
---
 usr.sbin/tzsetup/tzsetup.8 |  1 -
 usr.sbin/tzsetup/tzsetup.c | 25 ++++++++++---------------
 2 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/usr.sbin/tzsetup/tzsetup.8 b/usr.sbin/tzsetup/tzsetup.8
index 4e70875ec74b..3fd463c31ee5 100644
--- a/usr.sbin/tzsetup/tzsetup.8
+++ b/usr.sbin/tzsetup/tzsetup.8
@@ -63,7 +63,6 @@ Skip the initial question about adjusting the clock if not 
set to UTC.
 will neither create nor delete
 .Pa /etc/wall_cmos_clock .
 On a newly installed system, the hardware clock will keep UTC.
-This option is enabled automatically on non-x86 hardware.
 .El
 .Pp
 It is possible to short-circuit the menu system by specifying the
diff --git a/usr.sbin/tzsetup/tzsetup.c b/usr.sbin/tzsetup/tzsetup.c
index 6629dd81f250..617de4efb765 100644
--- a/usr.sbin/tzsetup/tzsetup.c
+++ b/usr.sbin/tzsetup/tzsetup.c
@@ -826,28 +826,23 @@ main(int argc, char **argv)
        char            prompt[128];
        int             fd;
 #endif
-       int             c, rv;
-       bool            skiputc;
-       char            *dztpath;
-#if defined(__i386__) || defined(__amd64__)
+       int             c, rv, skiputc;
        char            vm_guest[16] = "";
        size_t          len = sizeof(vm_guest);
+       char            *dztpath;
 
-       skiputc = false;
-
-       /* Default skiputc to true for VM guests */
-       if (sysctlbyname("kern.vm_guest", vm_guest, &len, NULL, 0) == 0 &&
-           strcmp(vm_guest, "none") != 0)
-               skiputc = true;
-#else
-       skiputc = true;
-#endif
        dztpath = NULL;
+       skiputc = 0;
 
 #ifdef HAVE_BSDDIALOG
        setlocale(LC_ALL, "");
 #endif
 
+       /* Default skiputc to 1 for VM guests */
+       if (sysctlbyname("kern.vm_guest", vm_guest, &len, NULL, 0) == 0 &&
+           strcmp(vm_guest, "none") != 0)
+               skiputc = 1;
+
        while ((c = getopt(argc, argv, "C:d:nrs")) != -1) {
                switch (c) {
                case 'C':
@@ -866,7 +861,7 @@ main(int argc, char **argv)
 #endif
                        break;
                case 's':
-                       skiputc = true;
+                       skiputc = 1;
                        break;
                default:
                        usage();
@@ -956,7 +951,7 @@ main(int argc, char **argv)
        if (bsddialog_init() == BSDDIALOG_ERROR)
                errx(1, "Error bsddialog: %s\n", bsddialog_geterror());
 
-       if (!skiputc) {
+       if (skiputc == 0) {
                snprintf(prompt, sizeof(prompt),
                    "Is this machine's CMOS clock set to UTC?  "
                    "If it is set to local time,\n"

Reply via email to