Bug 58483 - [patch] mount(8): allow type special or node relative names
Summary: [patch] mount(8): allow type special or node relative names
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 5.1-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2003-10-24 12:00 UTC by Oleg Karachevtsev
Modified: 2022-10-17 12:39 UTC (History)
0 users

See Also:


Attachments
file.diff (844 bytes, patch)
2003-10-24 12:00 UTC, Oleg Karachevtsev
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Karachevtsev 2003-10-24 12:00:34 UTC
	Allows type special or node relative names.

How-To-Repeat: 	>cd /dev; mount acd0
	mount: acd0: unknown special file or file system
	>cd /mnt; mount cdrom
	mount: cdrom: unknown special file or file system
Comment 1 Oleg Karachevtsev 2003-10-24 13:53:00 UTC
While realpath() used rmslashes() is not need at all.

Index: getmntopts.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount/getmntopts.c,v
retrieving revision 1.10
diff -u -r1.10 getmntopts.c
--- getmntopts.c	3 May 2003 18:41:58 -0000	1.10
+++ getmntopts.c	24 Oct 2003 12:40:57 -0000
@@ -110,28 +110,6 @@
 }
 
 void
-rmslashes(rrpin, rrpout)
-	char *rrpin;
-	char *rrpout;
-{
-	char *rrpoutstart;
-
-	*rrpout = *rrpin;
-	for (rrpoutstart = rrpout; *rrpin != '\0'; *rrpout++ = *rrpin++) {
-
-		/* skip all double slashes */
-		while (*rrpin == '/' && *(rrpin + 1) == '/')
-			 rrpin++;
-	}
-
-	/* remove trailing slash if necessary */
-	if (rrpout - rrpoutstart > 1 && *(rrpout - 1) == '/')
-		*(rrpout - 1) = '\0';
-	else
-		*rrpout = '\0';
-}
-
-void
 checkpath(path, resolved)
 	const char *path;
 	char *resolved;
Index: mntopts.h
===================================================================
RCS file: /home/ncvs/src/sbin/mount/mntopts.h,v
retrieving revision 1.20
diff -u -r1.20 mntopts.h
--- mntopts.h	14 Oct 2002 19:40:00 -0000	1.20
+++ mntopts.h	24 Oct 2003 12:40:57 -0000
@@ -93,6 +93,5 @@
 	MOPT_ACLS
 
 void getmntopts(const char *, const struct mntopt *, int *, int *);
-void rmslashes(char *, char *);
 void checkpath(const char *, char resolved_path[]);
 extern int getmnt_silent;
Index: mount.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount/mount.c,v
retrieving revision 1.54
diff -u -r1.54 mount.c
--- mount.c	7 Aug 2003 04:51:41 -0000	1.54
+++ mount.c	24 Oct 2003 12:40:58 -0000
@@ -136,6 +136,7 @@
 	pid_t pid;
 	int all, ch, i, init_flags, mntsize, rval, have_fstab;
 	char *cp, *ep, *options;
+	char mntnamereal[MAXPATHLEN];
 
 	all = init_flags = 0;
 	options = NULL;
@@ -271,9 +272,9 @@
 			    mntbuf->f_mntonname, init_flags, options, 0);
 			break;
 		}
-		rmslashes(*argv, *argv);
-		if ((fs = getfsfile(*argv)) == NULL &&
-		    (fs = getfsspec(*argv)) == NULL)
+		if (realpath(*argv,mntnamereal) == NULL ||
+		    ((fs = getfsfile(mntnamereal)) == NULL &&
+		     (fs = getfsspec(mntnamereal)) == NULL))
 			errx(1, "%s: unknown special file or file system",
 			    *argv);
 		if (BADTYPE(fs->fs_type))


-- 
WBR, Oleg Karachevtsev
http://dik.pp.ru
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:39 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 3 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:39:45 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>