diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2003-07-03 22:41:41 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2003-07-03 22:41:41 +0000 |
commit | 68c4ff61328d01e604a97f41a255784b3ba007b2 (patch) | |
tree | 7424873456d7982920c124a4f0a56cb7140ca8c8 /sbin/mount_msdos | |
parent | f231113e2426ef83d1f4662298c597f2d2719ed5 (diff) |
use realpath() in helpers instead of doing it ourselves every time.
also fixes pr1662. from otto moerbeek
Diffstat (limited to 'sbin/mount_msdos')
-rw-r--r-- | sbin/mount_msdos/mount_msdos.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/sbin/mount_msdos/mount_msdos.c b/sbin/mount_msdos/mount_msdos.c index 13969e8e1c6..29e18c26232 100644 --- a/sbin/mount_msdos/mount_msdos.c +++ b/sbin/mount_msdos/mount_msdos.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mount_msdos.c,v 1.17 2003/07/02 22:38:53 avsm Exp $ */ +/* $OpenBSD: mount_msdos.c,v 1.18 2003/07/03 22:41:40 tedu Exp $ */ /* $NetBSD: mount_msdos.c,v 1.16 1996/10/24 00:12:50 cgd Exp $ */ /* @@ -32,7 +32,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: mount_msdos.c,v 1.17 2003/07/02 22:38:53 avsm Exp $"; +static char rcsid[] = "$OpenBSD: mount_msdos.c,v 1.18 2003/07/03 22:41:40 tedu Exp $"; #endif /* not lint */ #include <sys/cdefs.h> @@ -68,7 +68,7 @@ main(int argc, char **argv) struct msdosfs_args args; struct stat sb; int c, mntflags, set_gid, set_uid, set_mask; - char *dev, *dir, ndir[MAXPATHLEN]; + char *dev, dir[MAXPATHLEN]; char *errcause; mntflags = set_gid = set_uid = set_mask = 0; @@ -117,16 +117,8 @@ main(int argc, char **argv) usage(); dev = argv[optind]; - dir = argv[optind + 1]; - if (dir[0] != '/') { - warnx("\"%s\" is a relative path.", dir); - if (getcwd(ndir, sizeof(ndir)) == NULL) - err(1, "getcwd"); - strlcat(ndir, "/", sizeof(ndir)); - strlcat(ndir, dir, sizeof(ndir)); - dir = ndir; - warnx("using \"%s\" instead.", dir); - } + if (realpath(argv[optind + 1], dir) == NULL) + err(1, "realpath %s", dir); args.fspec = dev; args.export_info.ex_root = -2; /* unchecked anyway on DOS fs */ |