Source-Changes-HG archive

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

[src/trunk]: src/sbin/umount make umount NAME= work



details:   https://anonhg.NetBSD.org/src/rev/d30f32851bdf
branches:  trunk
changeset: 971398:d30f32851bdf
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Apr 23 04:21:13 2020 +0000

description:
make umount NAME= work

diffstat:

 sbin/umount/Makefile |   4 +++-
 sbin/umount/umount.c |  20 +++++++++++++++-----
 2 files changed, 18 insertions(+), 6 deletions(-)

diffs (88 lines):

diff -r b6dd6a852970 -r d30f32851bdf sbin/umount/Makefile
--- a/sbin/umount/Makefile      Thu Apr 23 04:18:06 2020 +0000
+++ b/sbin/umount/Makefile      Thu Apr 23 04:21:13 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.19 2019/10/13 07:28:13 mrg Exp $
+#      $NetBSD: Makefile,v 1.20 2020/04/23 04:21:13 christos Exp $
 #      @(#)Makefile    8.4 (Berkeley) 6/22/95
 
 .include <bsd.own.mk>
@@ -15,6 +15,8 @@
 .PATH: ${MOUNT}
 SRCS+= vfslist.c
 .endif
+LDADD+=-lutil
+DPADD+=${LIBUTIL}
 
 COPTS.umount.c+=       ${GCC_NO_CAST_FUNCTION_TYPE}
 
diff -r b6dd6a852970 -r d30f32851bdf sbin/umount/umount.c
--- a/sbin/umount/umount.c      Thu Apr 23 04:18:06 2020 +0000
+++ b/sbin/umount/umount.c      Thu Apr 23 04:21:13 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: umount.c,v 1.52 2016/06/26 04:01:30 dholland Exp $     */
+/*     $NetBSD: umount.c,v 1.53 2020/04/23 04:21:13 christos Exp $     */
 
 /*-
  * Copyright (c) 1980, 1989, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)umount.c   8.8 (Berkeley) 5/8/95";
 #else
-__RCSID("$NetBSD: umount.c,v 1.52 2016/06/26 04:01:30 dholland Exp $");
+__RCSID("$NetBSD: umount.c,v 1.53 2020/04/23 04:21:13 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -65,6 +65,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <util.h>
 
 typedef enum { MNTANY, MNTON, MNTFROM } mntwhat;
 
@@ -90,6 +91,7 @@
 main(int argc, char *argv[])
 {
        int ch, errs, all = 0, raw = 0;
+       char mntfromname[MAXPATHLEN];
 #ifndef SMALL
        int mnts;
        struct statvfs *mntbuf;
@@ -168,9 +170,13 @@
                }
        } else 
 #endif /* !SMALL */
-               for (errs = 0; *argv != NULL; ++argv)
-                       if (umountfs(*argv, typelist, raw) != 0)
+               for (errs = 0; *argv != NULL; ++argv) {
+                       if (getfsspecname(mntfromname, sizeof(mntfromname),
+                           *argv) == NULL)
+                               err(EXIT_FAILURE, "%s", mntfromname);
+                       if (umountfs(mntfromname, typelist, raw) != 0)
                                errs = 1;
+               }
        return errs;
 }
 
@@ -339,6 +345,7 @@
 {
        static struct statvfs *mntbuf;
        static int mntsize;
+       static char mntfromname[MAXPATHLEN];
        int i;
 
        if (mntbuf == NULL &&
@@ -355,7 +362,10 @@
                if ((what == MNTFROM) && !strcmp(mntbuf[i].f_mntonname, name)) {
                        if (type)
                                *type = mntbuf[i].f_fstypename;
-                       return (mntbuf[i].f_mntfromname);
+                       if (getfsspecname(mntfromname, sizeof(mntfromname),
+                           mntbuf[i].f_mntfromname) == NULL)
+                               err(EXIT_FAILURE, "%s", mntfromname);
+                       return mntfromname;
                }
        }
        return (NULL);



Home | Main Index | Thread Index | Old Index