diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2020-12-24 11:38:48 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-12-24 12:06:49 -0800 |
commit | 0008af95e3335e70bc5a08f17a68378bd32f92ab (patch) | |
tree | da8b2c953c758c573545cbcd74c85b96a9b831c4 /lib/linkat.c | |
parent | d3aa6a7eed7745570eb6af820305755e9fab20cf (diff) | |
download | gnulib-0008af95e3335e70bc5a08f17a68378bd32f92ab.tar.gz |
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.
Diffstat (limited to 'lib/linkat.c')
-rw-r--r-- | lib/linkat.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/linkat.c b/lib/linkat.c index 13313e9d17..6fc9635376 100644 --- a/lib/linkat.c +++ b/lib/linkat.c @@ -29,20 +29,10 @@ #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 @@ -105,7 +95,7 @@ link_follow (char const *file1, char const *file2) 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 @@ -231,7 +221,7 @@ linkat_follow (int fd1, char const *file1, int fd2, char const *file2) 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))) |