Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/sysinst Do not strip the trailing / on root mounts ...
details: https://anonhg.NetBSD.org/src/rev/9103c614126e
branches: trunk
changeset: 462948:9103c614126e
user: martin <martin%NetBSD.org@localhost>
date: Thu Aug 01 16:32:06 2019 +0000
description:
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 2fa4cf6156ad -r 9103c614126e usr.sbin/sysinst/disks.c
--- a/usr.sbin/sysinst/disks.c Thu Aug 01 15:21:50 2019 +0000
+++ b/usr.sbin/sysinst/disks.c Thu Aug 01 16:32:06 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.45 2019/08/01 16:32:06 martin 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 2fa4cf6156ad -r 9103c614126e usr.sbin/sysinst/label.c
--- a/usr.sbin/sysinst/label.c Thu Aug 01 15:21:50 2019 +0000
+++ b/usr.sbin/sysinst/label.c Thu Aug 01 16:32:06 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.11 2019/08/01 16:32:06 martin 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.11 2019/08/01 16:32:06 martin 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 2fa4cf6156ad -r 9103c614126e usr.sbin/sysinst/target.c
--- a/usr.sbin/sysinst/target.c Thu Aug 01 15:21:50 2019 +0000
+++ b/usr.sbin/sysinst/target.c Thu Aug 01 16:32:06 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.9 2019/08/01 16:32:06 martin 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.9 2019/08/01 16:32:06 martin 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