summaryrefslogtreecommitdiff
path: root/gnulib/import/canonicalize-lgpl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gnulib/import/canonicalize-lgpl.c')
-rw-r--r--gnulib/import/canonicalize-lgpl.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/gnulib/import/canonicalize-lgpl.c b/gnulib/import/canonicalize-lgpl.c
index 4bb4c0c2d96..a7fa7feb62e 100644
--- a/gnulib/import/canonicalize-lgpl.c
+++ b/gnulib/import/canonicalize-lgpl.c
@@ -1,18 +1,18 @@
/* Return the canonical absolute name of a given file.
- Copyright (C) 1996-2021 Free Software Foundation, Inc.
+ Copyright (C) 1996-2022 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
- modify it under the terms of the GNU General Public
+ modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
+ version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU General Public
+ You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
@@ -21,7 +21,6 @@
optimizes away the name == NULL test below. */
# define _GL_ARG_NONNULL(params)
-# define _GL_USE_STDLIB_ALLOC 1
# include <libc-config.h>
#endif
@@ -75,7 +74,12 @@
# define __pathconf pathconf
# define __rawmemchr rawmemchr
# define __readlink readlink
-# define __stat stat
+# if IN_RELOCWRAPPER
+ /* When building the relocatable program wrapper, use the system's memmove
+ function, not the gnulib override, otherwise we would get a link error.
+ */
+# undef memmove
+# endif
#endif
/* Suppress bogus GCC -Wmaybe-uninitialized warnings. */
@@ -100,7 +104,7 @@ file_accessible (char const *file)
return __faccessat (AT_FDCWD, file, F_OK, AT_EACCESS) == 0;
# else
struct stat st;
- return __stat (file, &st) == 0 || errno == EOVERFLOW;
+ return stat (file, &st) == 0 || errno == EOVERFLOW;
# endif
}
@@ -141,11 +145,11 @@ suffix_requires_dir_check (char const *end)
macOS 10.13 <https://bugs.gnu.org/30350>, and should also work on
platforms like AIX 7.2 that need at least "/.". */
-#if defined _LIBC || defined LSTAT_FOLLOWS_SLASHED_SYMLINK
+# if defined _LIBC || defined LSTAT_FOLLOWS_SLASHED_SYMLINK
static char const dir_suffix[] = "/";
-#else
+# else
static char const dir_suffix[] = "/./";
-#endif
+# endif
/* Return true if DIR is a searchable dir, false (setting errno) otherwise.
DIREND points to the NUL byte at the end of the DIR string.
@@ -187,13 +191,13 @@ get_path_max (void)
to pacify GCC is known; even an explicit #pragma does not pacify GCC.
When the GCC bug is fixed this workaround should be limited to the
broken GCC versions. */
-#if __GNUC_PREREQ (10, 1)
-# if defined GCC_LINT || defined lint
+# if __GNUC_PREREQ (10, 1)
+# if defined GCC_LINT || defined lint
__attribute__ ((__noinline__))
-# elif __OPTIMIZE__ && !__NO_INLINE__
-# define GCC_BOGUS_WRETURN_LOCAL_ADDR
+# elif __OPTIMIZE__ && !__NO_INLINE__
+# define GCC_BOGUS_WRETURN_LOCAL_ADDR
+# endif
# endif
-#endif
static char *
realpath_stk (const char *name, char *resolved,
struct scratch_buffer *rname_buf)
@@ -439,7 +443,8 @@ __realpath (const char *name, char *resolved)
}
libc_hidden_def (__realpath)
versioned_symbol (libc, __realpath, realpath, GLIBC_2_3);
-#endif /* !FUNC_REALPATH_WORKS || defined _LIBC */
+
+#endif /* defined _LIBC || !FUNC_REALPATH_WORKS */
#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3)