projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mgetgroups: remove dependency on realloc-gnu
[gnulib.git]
/
lib
/
canonicalize-lgpl.c
diff --git
a/lib/canonicalize-lgpl.c
b/lib/canonicalize-lgpl.c
index
0888501
..
6cbd2e0
100644
(file)
--- a/
lib/canonicalize-lgpl.c
+++ b/
lib/canonicalize-lgpl.c
@@
-1,5
+1,5
@@
/* Return the canonical absolute name of a given file.
/* Return the canonical absolute name of a given file.
- Copyright (C) 1996-201
2
Free Software Foundation, Inc.
+ Copyright (C) 1996-201
3
Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
@@
-16,16
+16,16
@@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _LIBC
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _LIBC
+/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
+ optimizes away the name == NULL test below. */
+# define _GL_ARG_NONNULL(params)
+
# define _GL_USE_STDLIB_ALLOC 1
# include <config.h>
#endif
#if !HAVE_CANONICALIZE_FILE_NAME || !FUNC_REALPATH_WORKS || defined _LIBC
# define _GL_USE_STDLIB_ALLOC 1
# include <config.h>
#endif
#if !HAVE_CANONICALIZE_FILE_NAME || !FUNC_REALPATH_WORKS || defined _LIBC
-/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
- optimizes away the name == NULL test below. */
-#define _GL_ARG_NONNULL(params)
-
/* Specification. */
#include <stdlib.h>
/* Specification. */
#include <stdlib.h>
@@
-157,6
+157,8
@@
__realpath (const char *name, char *resolved)
goto error;
}
dest = strchr (rpath, '\0');
goto error;
}
dest = strchr (rpath, '\0');
+ start = name;
+ prefix_len = FILE_SYSTEM_PREFIX_LEN (rpath);
}
else
{
}
else
{
@@
-173,9
+175,10
@@
__realpath (const char *name, char *resolved)
*dest++ = '/';
*dest = '\0';
}
*dest++ = '/';
*dest = '\0';
}
+ start = name + prefix_len;
}
}
- for (
start = end = name + prefix_len
; *start; start = end)
+ for (
end = start
; *start; start = end)
{
#ifdef _LIBC
struct stat64 st;
{
#ifdef _LIBC
struct stat64 st;
@@
-200,7
+203,7
@@
__realpath (const char *name, char *resolved)
{
/* Back up to previous component, ignore if at root already. */
if (dest > rpath + prefix_len + 1)
{
/* Back up to previous component, ignore if at root already. */
if (dest > rpath + prefix_len + 1)
- for (--dest; !ISSLASH (dest[-1]); --dest)
+ for (--dest;
dest > rpath &&
!ISSLASH (dest[-1]); --dest)
continue;
if (DOUBLE_SLASH_IS_DISTINCT_ROOT
&& dest == rpath + 1 && !prefix_len
continue;
if (DOUBLE_SLASH_IS_DISTINCT_ROOT
&& dest == rpath + 1 && !prefix_len
@@
-334,7
+337,7
@@
__realpath (const char *name, char *resolved)
/* Back up to previous component, ignore if at root
already: */
if (dest > rpath + prefix_len + 1)
/* Back up to previous component, ignore if at root
already: */
if (dest > rpath + prefix_len + 1)
- for (--dest; !ISSLASH (dest[-1]); --dest)
+ for (--dest;
dest > rpath &&
!ISSLASH (dest[-1]); --dest)
continue;
if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1
&& ISSLASH (*dest) && !ISSLASH (dest[1]) && !prefix_len)
continue;
if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1
&& ISSLASH (*dest) && !ISSLASH (dest[1]) && !prefix_len)