Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/usr.sbin/sysinst Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/ed00f00aaca2
branches:  netbsd-9
changeset: 453076:ed00f00aaca2
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Aug 02 05:41:46 2019 +0000

description:
Pull up following revision(s) (requested by martin in ticket #4):
        usr.sbin/sysinst/target.c: revision 1.9
        usr.sbin/sysinst/disks.c: revision 1.45
        usr.sbin/sysinst/label.c: revision 1.11
Do not strip the trailing / on root mounts when evaluation "last mounted
on". Fix some /dev/ and raw vs. block device confusion on system upgrades.

diffstat:

 usr.sbin/sysinst/disks.c  |  26 +++++++++++++++++++++-----
 usr.sbin/sysinst/label.c  |  10 ++++++++--
 usr.sbin/sysinst/target.c |   7 +++++--
 3 files changed, 34 insertions(+), 9 deletions(-)

diffs (119 lines):

diff -r b978b5a5921a -r ed00f00aaca2 usr.sbin/sysinst/disks.c
--- a/usr.sbin/sysinst/disks.c  Fri Aug 02 05:39:28 2019 +0000
+++ b/usr.sbin/sysinst/disks.c  Fri Aug 02 05:41:46 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disks.c,v 1.44 2019/07/25 13:11:15 martin Exp $ */
+/*     $NetBSD: disks.c,v 1.44.2.1 2019/08/02 05:41:46 msaitoh Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -80,6 +80,8 @@
        daddr_t dd_totsec;
 };
 
+static const char name_prefix[] = "NAME=";
+
 /* Local prototypes */
 static int foundffs(struct data *, size_t);
 #ifdef USE_SYSVBFS
@@ -1399,23 +1401,37 @@
        return 0;
 }
 
-
-
 static int
 /*ARGSUSED*/
 foundffs(struct data *list, size_t num)
 {
        int error;
+       char rbuf[PATH_MAX], buf[PATH_MAX];
+       const char *rdev, *dev;
 
        if (num < 2 || strcmp(list[1].u.s_val, "/") == 0 ||
            strstr(list[2].u.s_val, "noauto") != NULL)
                return 0;
 
-       error = fsck_preen(list[0].u.s_val, "ffs", false);
+       /* need the raw device for fsck_preen */
+       if (strncmp(list[0].u.s_val, name_prefix, sizeof(name_prefix)-1)
+            != 0) {
+               strcpy(rbuf, "/dev/r");
+               strlcat(rbuf, list[0].u.s_val, sizeof(rbuf));
+               rdev = rbuf;
+               strcpy(buf, "/dev/");
+               strlcat(buf, list[0].u.s_val, sizeof(buf));
+               dev = buf;
+       } else {
+               rdev = list[0].u.s_val;
+               dev = list[0].u.s_val;
+       }
+
+       error = fsck_preen(rdev, "ffs", false);
        if (error != 0)
                return error;
 
-       error = target_mount("", list[0].u.s_val, list[1].u.s_val);
+       error = target_mount("", dev, list[1].u.s_val);
        if (error != 0) {
                msg_fmt_display(MSG_mount_failed, "%s", list[0].u.s_val);
                if (!ask_noyes(NULL))
diff -r b978b5a5921a -r ed00f00aaca2 usr.sbin/sysinst/label.c
--- a/usr.sbin/sysinst/label.c  Fri Aug 02 05:39:28 2019 +0000
+++ b/usr.sbin/sysinst/label.c  Fri Aug 02 05:41:46 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: label.c,v 1.10 2019/07/26 08:18:47 martin Exp $        */
+/*     $NetBSD: label.c,v 1.10.2.1 2019/08/02 05:41:46 msaitoh Exp $   */
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: label.c,v 1.10 2019/07/26 08:18:47 martin Exp $");
+__RCSID("$NetBSD: label.c,v 1.10.2.1 2019/08/02 05:41:46 msaitoh Exp $");
 #endif
 
 #include <sys/types.h>
@@ -1487,6 +1487,12 @@
 {
        char *p;
 
+       if (path == NULL)
+               return;
+
+       if (strcmp(path, "/") == 0)
+               return; /* in this case a "trailing" slash is allowed */
+
        for (;;) {
                p = strrchr(path, '/');
                if (p == NULL)
diff -r b978b5a5921a -r ed00f00aaca2 usr.sbin/sysinst/target.c
--- a/usr.sbin/sysinst/target.c Fri Aug 02 05:39:28 2019 +0000
+++ b/usr.sbin/sysinst/target.c Fri Aug 02 05:41:46 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: target.c,v 1.8 2019/07/23 18:13:40 martin Exp $        */
+/*     $NetBSD: target.c,v 1.8.2.1 2019/08/02 05:41:46 msaitoh Exp $   */
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -71,7 +71,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: target.c,v 1.8 2019/07/23 18:13:40 martin Exp $");
+__RCSID("$NetBSD: target.c,v 1.8.2.1 2019/08/02 05:41:46 msaitoh Exp $");
 #endif
 
 /*
@@ -209,6 +209,9 @@
 bool
 is_root_part_mount(const char *last_mounted)
 {
+       if (last_mounted == NULL)
+               return false;
+
        return strcmp(last_mounted, "/") == 0 ||
            strcmp(last_mounted, "/targetroot") == 0 ||
            strcmp(last_mounted, "/altroot") == 0;



Home | Main Index | Thread Index | Old Index