Source-Changes-HG archive

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

[src/trunk]: src/sbin/resize_lfs Use getdiskrawname to find the device name.



details:   https://anonhg.NetBSD.org/src/rev/c0f64b9c1537
branches:  trunk
changeset: 453680:c0f64b9c1537
user:      brad <brad%NetBSD.org@localhost>
date:      Thu Aug 22 20:26:07 2019 +0000

description:
Use getdiskrawname to find the device name.

Reviewed by Christos

diffstat:

 sbin/resize_lfs/resize_lfs.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r e409a292aaef -r c0f64b9c1537 sbin/resize_lfs/resize_lfs.c
--- a/sbin/resize_lfs/resize_lfs.c      Thu Aug 22 20:23:43 2019 +0000
+++ b/sbin/resize_lfs/resize_lfs.c      Thu Aug 22 20:26:07 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: resize_lfs.c,v 1.14 2015/08/02 18:18:09 dholland Exp $ */
+/*     $NetBSD: resize_lfs.c,v 1.15 2019/08/22 20:26:07 brad Exp $     */
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -47,6 +47,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <util.h>
 
 #include "partutil.h"
 
@@ -98,7 +99,8 @@
                err(1, "%s", fsname);
        rdevlen = strlen(vfs.f_mntfromname) + 2;
        rdev = malloc(rdevlen);
-       snprintf(rdev, rdevlen, "/dev/r%s", vfs.f_mntfromname + 5);
+       if (getdiskrawname(rdev, rdevlen, vfs.f_mntfromname) == NULL)
+               err(1, "Could not convert '%s' to raw name", vfs.f_mntfromname);
        devfd = open(rdev, O_RDONLY);
        if (devfd < 0)
                err(1, "open raw device");



Home | Main Index | Thread Index | Old Index