aboutsummaryrefslogtreecommitdiff
path: root/stdlib/canonicalize.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /stdlib/canonicalize.c
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
downloadglibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.bz2
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip
2.5-18.1
Diffstat (limited to 'stdlib/canonicalize.c')
-rw-r--r--stdlib/canonicalize.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c
index 2168bbd90e..19808b50d6 100644
--- a/stdlib/canonicalize.c
+++ b/stdlib/canonicalize.c
@@ -1,5 +1,5 @@
/* Return the canonical absolute name of a given file.
- Copyright (C) 1996-2001, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1996-2002, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -91,7 +91,7 @@ __realpath (const char *name, char *resolved)
rpath[0] = '\0';
goto error;
}
- dest = strchr (rpath, '\0');
+ dest = __rawmemchr (rpath, '\0');
}
else
{
@@ -199,6 +199,11 @@ __realpath (const char *name, char *resolved)
if (dest > rpath + 1)
while ((--dest)[-1] != '/');
}
+ else if (!S_ISDIR (st.st_mode) && *end != '\0')
+ {
+ __set_errno (ENOTDIR);
+ goto error;
+ }
}
}
if (dest > rpath + 1 && dest[-1] == '/')