Date: Tue, 28 Mar 2000 08:30:02 -0800 (PST) From: Mikhail Teterin <mi@aldan.algebra.com> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/7063: mount fails if $PWD does not exist Message-ID: <200003281630.IAA25713@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/7063; it has been noted by GNATS.
From: Mikhail Teterin <mi@aldan.algebra.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc:
Subject: Re: bin/7063: mount fails if $PWD does not exist
Date: Tue, 28 Mar 2000 11:21:33 -0500
This is a multi-part message in MIME format.
--------------94B7256161EBABF294F5ABEB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
An almost identical problem still exists :(
If the directory was just plain removed after one cd-ed
into it, mount will work. But if the entire file-system
was unmounted, mount will fail:
root@rtfm:src/sys/compile (123) mount /cdrom0
mount: .: Not a directory
even though none of its parameteres involve current directory
or the unmounted file-system.
It appears, the problem is with realpath(3), which mount
invokes. realpath() insists on . being openable.
May be, something like the attached is needed (damn the goto)?
In any case, an entry in the CAVEATS section of realpath(3)
is in order explaining its behavior in case `.' does not
exist.
-mi
--------------94B7256161EBABF294F5ABEB
Content-Type: text/plain; charset=us-ascii;
name="p"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="p"
--- lib/libc/stdlib/realpath.c Thu Jan 27 18:06:50 2000
+++ lib/libc/stdlib/realpath.c Tue Mar 28 11:11:03 2000
@@ -68,7 +68,4 @@
- /* Save the starting point. */
- if ((fd = _open(".", O_RDONLY)) < 0) {
- (void)strcpy(resolved, ".");
- return (NULL);
- }
+ /* Save the starting point, if possible */
+ fd = _open(".", O_RDONLY);
@@ -149,4 +146,4 @@
- /* Go back to where we came from. */
- if (fchdir(fd) < 0) {
+ /* Go back to where we came from. If we know where, that is */
+ if (fd >= 0 && fchdir(fd) < 0) {
serrno = errno;
@@ -160,4 +157,4 @@
err1: serrno = errno;
- (void)fchdir(fd);
-err2: (void)_close(fd);
+ if (fd >=0) (void)fchdir(fd);
+err2: if (fd >=0) (void)_close(fd);
errno = serrno;
--------------94B7256161EBABF294F5ABEB--
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200003281630.IAA25713>
