From owner-freebsd-bugs Tue Mar 28 8:30: 9 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 2ED5837BDDE for ; Tue, 28 Mar 2000 08:30:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id IAA25713; Tue, 28 Mar 2000 08:30:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Date: Tue, 28 Mar 2000 08:30:02 -0800 (PST) Message-Id: <200003281630.IAA25713@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Mikhail Teterin Subject: Re: bin/7063: mount fails if $PWD does not exist Reply-To: Mikhail Teterin Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/7063; it has been noted by GNATS. From: Mikhail Teterin 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