Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/newfs Push the mount path for mount_mfs through realpat...
details: https://anonhg.NetBSD.org/src/rev/c286d39dd71c
branches: trunk
changeset: 750210:c286d39dd71c
user: dsl <dsl%NetBSD.org@localhost>
date: Sun Dec 20 15:21:13 2009 +0000
description:
Push the mount path for mount_mfs through realpath().
This matches what other fs do.
Fixes PR/20362
diffstat:
sbin/newfs/Makefile | 8 +++++---
sbin/newfs/newfs.c | 20 +++++++++++++-------
2 files changed, 18 insertions(+), 10 deletions(-)
diffs (109 lines):
diff -r 9ec50e5784c9 -r c286d39dd71c sbin/newfs/Makefile
--- a/sbin/newfs/Makefile Sun Dec 20 13:56:36 2009 +0000
+++ b/sbin/newfs/Makefile Sun Dec 20 15:21:13 2009 +0000
@@ -1,15 +1,17 @@
-# $NetBSD: Makefile,v 1.34 2009/06/06 11:09:16 haad Exp $
+# $NetBSD: Makefile,v 1.35 2009/12/20 15:21:13 dsl Exp $
# @(#)Makefile 8.2 (Berkeley) 3/27/94
.include <bsd.own.mk>
PROG= newfs
SRCS= dkcksum.c newfs.c mkfs.c ffs_bswap.c ffs_appleufs.c partutil.c
+SRCS+= pathadj.c
MAN= newfs.8 mount_mfs.8
DISKLABEL=${NETBSDSRCDIR}/sbin/disklabel
FSCK=${NETBSDSRCDIR}/sbin/fsck
-CPPFLAGS+=-DMFS -I${.CURDIR} -I${DISKLABEL} -I${FSCK}
+MOUNT=${NETBSDSRCDIR}/sbin/mount
+CPPFLAGS+=-DMFS -I${.CURDIR} -I${DISKLABEL} -I${FSCK} -I${MOUNT}
DPADD+= ${LIBUTIL}
LDADD+= -lutil
@@ -17,7 +19,7 @@
LDADD+=-lprop
DPADD+=${LIBPROP}
-.PATH: ${DISKLABEL} ${NETBSDSRCDIR}/sys/ufs/ffs ${FSCK}
+.PATH: ${DISKLABEL} ${NETBSDSRCDIR}/sys/ufs/ffs ${FSCK} ${MOUNT}
LINKS= ${BINDIR}/newfs ${BINDIR}/mount_mfs
MLINKS= mount_mfs.8 mfs.8
diff -r 9ec50e5784c9 -r c286d39dd71c sbin/newfs/newfs.c
--- a/sbin/newfs/newfs.c Sun Dec 20 13:56:36 2009 +0000
+++ b/sbin/newfs/newfs.c Sun Dec 20 15:21:13 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: newfs.c,v 1.105 2009/05/07 06:56:56 lukem Exp $ */
+/* $NetBSD: newfs.c,v 1.106 2009/12/20 15:21:13 dsl Exp $ */
/*
* Copyright (c) 1983, 1989, 1993, 1994
@@ -78,7 +78,7 @@
#if 0
static char sccsid[] = "@(#)newfs.c 8.13 (Berkeley) 5/1/95";
#else
-__RCSID("$NetBSD: newfs.c,v 1.105 2009/05/07 06:56:56 lukem Exp $");
+__RCSID("$NetBSD: newfs.c,v 1.106 2009/12/20 15:21:13 dsl Exp $");
#endif
#endif /* not lint */
@@ -117,6 +117,10 @@
#include <util.h>
#include <mntopts.h>
+#ifdef MFS
+#include <mountprog.h>
+#endif
+
#include "dkcksum.h"
#include "extern.h"
#include "partutil.h"
@@ -238,6 +242,7 @@
#ifdef MFS
struct mfs_args args;
char mountfromname[100];
+ char mounttoname[MAXPATHLEN];
pid_t pid, res;
struct statvfs sf;
int status;
@@ -653,6 +658,7 @@
#ifdef MFS
if (mfs) {
+ pathadj(argv[1], mounttoname);
switch (pid = fork()) {
case -1:
perror("mfs");
@@ -676,10 +682,10 @@
* can mount a filesystem which hides our
* ramdisk before we see the success.
*/
- if (statvfs(argv[1], &sf) < 0)
- err(88, "statvfs %s", argv[1]);
+ if (statvfs(mounttoname, &sf) < 0)
+ err(88, "statvfs %s", mounttoname);
if (!strcmp(sf.f_mntfromname, mountfromname) &&
- !strncmp(sf.f_mntonname, argv[1],
+ !strncmp(sf.f_mntonname, mounttoname,
MNAMELEN) &&
!strcmp(sf.f_fstypename, "mfs"))
exit(0);
@@ -692,7 +698,7 @@
if (WIFEXITED(status)) {
if (WEXITSTATUS(status) == 0)
exit(0);
- errx(1, "%s: mount: %s", argv[1],
+ errx(1, "%s: mount: %s", mounttoname,
strerror(WEXITSTATUS(status)));
} else
errx(11, "abnormal termination");
@@ -708,7 +714,7 @@
args.base = membase;
args.size = fssize * sectorsize;
- if (mount(MOUNT_MFS, argv[1], mntflags | MNT_ASYNC,
+ if (mount(MOUNT_MFS, mounttoname, mntflags | MNT_ASYNC,
&args, sizeof args) == -1)
exit(errno); /* parent prints message */
}
Home |
Main Index |
Thread Index |
Old Index