Date: Fri, 24 Oct 2003 06:00:36 -0700 (PDT) From: Oleg Karachevtsev <ok@etrust.ru> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/58483: [PATCH] allows type special or node relative names Message-ID: <200310241300.h9OD0aI9068894@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/58483; it has been noted by GNATS. From: Oleg Karachevtsev <ok@etrust.ru> To: freebsd-gnats-submit@FreeBSD.org, ok@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200310241300.h9OD0aI9068894>