Source-Changes-HG archive

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

[src/netbsd-9]: src/sbin/fsck Pull up following revision(s) (requested by han...



details:   https://anonhg.NetBSD.org/src/rev/a015f55a218e
branches:  netbsd-9
changeset: 372893:a015f55a218e
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Jan 03 18:22:09 2023 +0000

description:
Pull up following revision(s) (requested by hannken in ticket #1560):

        sbin/fsck/partutil.c: revision 1.18

Change getdiskinfo() to no longer infer the partition from the device name.

Since 2016-06-16 we create disk devices "<type><<unit>" as an alias
for "<type><<unit><part>" where "<part>" is the raw partition.
These devices are treated as invalid partitions and a zero geometry
is returned.

Take the partition from "st_rdev" instead.

Fix for PR kern/57134: st_size of stat on vnd raw partition sometimes
is 0, causing newfs to fail

diffstat:

 sbin/fsck/partutil.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (30 lines):

diff -r 96c8874dbabe -r a015f55a218e sbin/fsck/partutil.c
--- a/sbin/fsck/partutil.c      Tue Jan 03 16:46:12 2023 +0000
+++ b/sbin/fsck/partutil.c      Tue Jan 03 18:22:09 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: partutil.c,v 1.15.18.2 2021/01/09 19:30:14 martin Exp $        */
+/*     $NetBSD: partutil.c,v 1.15.18.3 2023/01/03 18:22:09 martin Exp $        */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: partutil.c,v 1.15.18.2 2021/01/09 19:30:14 martin Exp $");
+__RCSID("$NetBSD: partutil.c,v 1.15.18.3 2023/01/03 18:22:09 martin Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -155,9 +155,8 @@
        if (stat(s, &sb) == -1)
                return 0;
 
-       ptn = strchr(s, '\0')[-1] - 'a';
-       if ((unsigned)ptn >= lp->d_npartitions ||
-           (devminor_t)ptn != DISKPART(sb.st_rdev))
+       ptn = DISKPART(sb.st_rdev);
+       if (ptn < 0 || ptn >= lp->d_npartitions)
                return 0;
 
        pp = &lp->d_partitions[ptn];



Home | Main Index | Thread Index | Old Index