Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/gen Don't allow last path element to be nonexistant.



details:   https://anonhg.NetBSD.org/src/rev/b82766d649d1
branches:  trunk
changeset: 583587:b82766d649d1
user:      elad <elad%NetBSD.org@localhost>
date:      Sat Aug 13 19:53:53 2005 +0000

description:
Don't allow last path element to be nonexistant.

diffstat:

 lib/libc/gen/getcwd.c   |  11 ++---------
 lib/libc/gen/realpath.3 |   9 ++-------
 2 files changed, 4 insertions(+), 16 deletions(-)

diffs (62 lines):

diff -r 836860b6b040 -r b82766d649d1 lib/libc/gen/getcwd.c
--- a/lib/libc/gen/getcwd.c     Sat Aug 13 17:50:59 2005 +0000
+++ b/lib/libc/gen/getcwd.c     Sat Aug 13 19:53:53 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getcwd.c,v 1.38 2005/07/05 02:56:12 enami Exp $        */
+/*     $NetBSD: getcwd.c,v 1.39 2005/08/13 19:53:53 elad Exp $ */
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1995
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)getcwd.c   8.5 (Berkeley) 2/7/95";
 #else
-__RCSID("$NetBSD: getcwd.c,v 1.38 2005/07/05 02:56:12 enami Exp $");
+__RCSID("$NetBSD: getcwd.c,v 1.39 2005/08/13 19:53:53 elad Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -159,13 +159,6 @@
         * target to unresolved path.
         */
        if (lstat(resolved, &sb) == -1) {
-               /* Allow nonexistent component if this is the last one. */
-               while (*q == '/')
-                       q++;
-               if (*q == 0 && errno == ENOENT) {
-                       errno = serrno;
-                       return (resolved);
-               }
                return (NULL);
        }
        if (S_ISLNK(sb.st_mode)) {
diff -r 836860b6b040 -r b82766d649d1 lib/libc/gen/realpath.3
--- a/lib/libc/gen/realpath.3   Sat Aug 13 17:50:59 2005 +0000
+++ b/lib/libc/gen/realpath.3   Sat Aug 13 19:53:53 2005 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: realpath.3,v 1.11 2003/08/07 16:42:55 agc Exp $
+.\"    $NetBSD: realpath.3,v 1.12 2005/08/13 19:53:53 elad Exp $
 .\"
 .\" Copyright (c) 1994
 .\"    The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"     from: @(#)realpath.3   8.2 (Berkeley) 2/16/94
 .\"
-.Dd February 16, 1994
+.Dd August 13, 2005
 .Dt REALPATH 3
 .Os
 .Sh NAME
@@ -72,11 +72,6 @@
 function will resolve both absolute and relative paths
 and return the absolute pathname corresponding to
 .Fa pathname .
-All but the last component of
-.Fa pathname
-must exist when
-.Fn realpath
-is called.
 .Sh RETURN VALUES
 The
 .Fn realpath



Home | Main Index | Thread Index | Old Index