* lib/linkat.c: Include eloop-threshold.h.
Do not include sys/param.h.
(MAXSYMLINKS): Remove.
(link_follow, linkat_follow): Use __eloop_threshold instead
of MAXSYMLINKS.
* m4/linkat.m4 (gl_FUNC_LINKAT): Omit sys/param.h check.
* modules/linkat (Depends-on): Add eloop-threshold. Sort.
2020-12-24 Paul Eggert <eggert@cs.ucla.edu>
+ linkat: use eloop-threshold
+ * lib/linkat.c: Include eloop-threshold.h.
+ Do not include sys/param.h.
+ (MAXSYMLINKS): Remove.
+ (link_follow, linkat_follow): Use __eloop_threshold instead
+ of MAXSYMLINKS.
+ * m4/linkat.m4 (gl_FUNC_LINKAT): Omit sys/param.h check.
+ * modules/linkat (Depends-on): Add eloop-threshold. Sort.
+
canonicalize-lgpl: use eloop-threshold
* lib/canonicalize-lgpl.c [!_LIBC]: Include eloop-threshold.h.
(MAXSYMLINKS, __eloop_threshold): Remove.
#include "areadlink.h"
#include "dirname.h"
+#include "eloop-threshold.h"
#include "filenamecat.h"
#include "openat-priv.h"
-#if HAVE_SYS_PARAM_H
-# include <sys/param.h>
-#endif
-#ifndef MAXSYMLINKS
-# ifdef SYMLOOP_MAX
-# define MAXSYMLINKS SYMLOOP_MAX
-# else
-# define MAXSYMLINKS 20
-# endif
-#endif
-
#if !HAVE_LINKAT || LINKAT_SYMLINK_NOTSUP
/* Create a link. If FILE1 is a symlink, either create a hardlink to
char *name = (char *) file1;
char *target;
int result;
- int i = MAXSYMLINKS;
+ int i = __eloop_threshold ();
/* Using realpath or canonicalize_file_name is too heavy-handed: we
don't need an absolute name, and we don't need to resolve
char *name = (char *) file1;
char *target;
int result;
- int i = MAXSYMLINKS;
+ int i = __eloop_threshold ();
/* There is no realpathat. */
while (i-- && (target = areadlinkat (fd1, name)))
-# serial 13
+# serial 14
# See if we need to provide linkat replacement.
dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_CHECK_FUNCS_ONCE([linkat symlink])
- AC_CHECK_HEADERS_ONCE([sys/param.h])
if test $ac_cv_func_linkat = no; then
HAVE_LINKAT=0
else
Depends-on:
unistd
extensions
+areadlink [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+at-internal [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
dirname-lgpl [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+eloop-threshold [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
errno [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
fcntl-h [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
filenamecat-lgpl [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
-link-follow [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
-areadlink [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
-at-internal [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
filename [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
fstat [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
getcwd-lgpl [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
-openat-h [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
-openat-die [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+link-follow [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
link [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
lstat [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+openat-die [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+openat-h [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
same-inode [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
save-cwd [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
stat [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]