Module Name: src
Committed By: christos
Date: Thu Apr 23 04:21:13 UTC 2020
Modified Files:
src/sbin/umount: Makefile umount.c
Log Message:
make umount NAME= work
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sbin/umount/Makefile
cvs rdiff -u -r1.52 -r1.53 src/sbin/umount/umount.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/umount/Makefile
diff -u src/sbin/umount/Makefile:1.19 src/sbin/umount/Makefile:1.20
--- src/sbin/umount/Makefile:1.19 Sun Oct 13 03:28:13 2019
+++ src/sbin/umount/Makefile Thu Apr 23 00:21:13 2020
@@ -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 @@ CPPFLAGS+= -I${MOUNT}
.PATH: ${MOUNT}
SRCS+= vfslist.c
.endif
+LDADD+=-lutil
+DPADD+=${LIBUTIL}
COPTS.umount.c+= ${GCC_NO_CAST_FUNCTION_TYPE}
Index: src/sbin/umount/umount.c
diff -u src/sbin/umount/umount.c:1.52 src/sbin/umount/umount.c:1.53
--- src/sbin/umount/umount.c:1.52 Sun Jun 26 00:01:30 2016
+++ src/sbin/umount/umount.c Thu Apr 23 00:21:13 2020
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
#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 @@ __RCSID("$NetBSD: umount.c,v 1.52 2016/0
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <util.h>
typedef enum { MNTANY, MNTON, MNTFROM } mntwhat;
@@ -90,6 +91,7 @@ int
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 @@ main(int argc, char *argv[])
}
} 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 @@ getmntname(const char *name, mntwhat wha
{
static struct statvfs *mntbuf;
static int mntsize;
+ static char mntfromname[MAXPATHLEN];
int i;
if (mntbuf == NULL &&
@@ -355,7 +362,10 @@ getmntname(const char *name, mntwhat wha
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);