summaryrefslogtreecommitdiff
path: root/sbin/mount_ados/mount_ados.c
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2003-07-03 22:41:41 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2003-07-03 22:41:41 +0000
commit68c4ff61328d01e604a97f41a255784b3ba007b2 (patch)
tree7424873456d7982920c124a4f0a56cb7140ca8c8 /sbin/mount_ados/mount_ados.c
parentf231113e2426ef83d1f4662298c597f2d2719ed5 (diff)
use realpath() in helpers instead of doing it ourselves every time.
also fixes pr1662. from otto moerbeek
Diffstat (limited to 'sbin/mount_ados/mount_ados.c')
-rw-r--r--sbin/mount_ados/mount_ados.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/sbin/mount_ados/mount_ados.c b/sbin/mount_ados/mount_ados.c
index be8da3859e8..188fd57a55e 100644
--- a/sbin/mount_ados/mount_ados.c
+++ b/sbin/mount_ados/mount_ados.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount_ados.c,v 1.11 2003/07/02 22:38:53 avsm Exp $ */
+/* $OpenBSD: mount_ados.c,v 1.12 2003/07/03 22:41:40 tedu Exp $ */
/* $NetBSD: mount_ados.c,v 1.5 1996/04/13 01:30:59 jtc Exp $ */
/*
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: mount_ados.c,v 1.11 2003/07/02 22:38:53 avsm Exp $";
+static char rcsid[] = "$OpenBSD: mount_ados.c,v 1.12 2003/07/03 22:41:40 tedu Exp $";
#endif /* not lint */
#include <sys/cdefs.h>
@@ -67,7 +67,7 @@ main(int argc, char *argv[])
struct adosfs_args args;
struct stat sb;
int c, mntflags, set_gid, set_uid, set_mask;
- char *dev, *dir, ndir[MAXPATHLEN+1];
+ char *dev, dir[MAXPATHLEN];
mntflags = set_gid = set_uid = set_mask = 0;
(void)memset(&args, '\0', sizeof(args));
@@ -100,16 +100,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 */