bin/58483: [PATCH] allows type special or node relative names

Oleg Karachevtsev ok at etrust.ru
Fri Oct 24 06:00:37 PDT 2003


The following reply was made to PR bin/58483; it has been noted by GNATS.

From: Oleg Karachevtsev <ok at etrust.ru>
To: freebsd-gnats-submit at FreeBSD.org, ok at etrust.ru
Cc:  
Subject: Re: bin/58483: [PATCH] allows type special or node relative names
Date: Fri, 24 Oct 2003 16:53:00 +0400

 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


More information about the freebsd-bugs mailing list