summaryrefslogtreecommitdiffstats
path: root/mount/realpath.c
diff options
context:
space:
mode:
authorKarel Zak2007-02-09 17:35:15 +0100
committerKarel Zak2007-02-09 17:35:15 +0100
commit4717ea4a97af59fca6a88a84e10add5d9539a473 (patch)
tree9476e2554229ad30658927647186d68a6c121dd9 /mount/realpath.c
parentswapon: does not correctly deal with symlinks (diff)
downloadkernel-qcow2-util-linux-4717ea4a97af59fca6a88a84e10add5d9539a473.tar.gz
kernel-qcow2-util-linux-4717ea4a97af59fca6a88a84e10add5d9539a473.tar.xz
kernel-qcow2-util-linux-4717ea4a97af59fca6a88a84e10add5d9539a473.zip
clean up realpath.[ch] includes and macros
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount/realpath.c')
-rw-r--r--mount/realpath.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/mount/realpath.c b/mount/realpath.c
index 373dbe82f..9dc517e4e 100644
--- a/mount/realpath.c
+++ b/mount/realpath.c
@@ -19,18 +19,15 @@
* This routine is part of libc. We include it nevertheless,
* since the libc version has some security flaws.
*/
-
-#include <limits.h> /* for PATH_MAX */
-#ifndef PATH_MAX
-#define PATH_MAX 8192
-#endif
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include "realpath.h"
#include "sundries.h" /* for xstrdup */
-#define MAX_READLINKS 32
+#ifndef MAXSYMLINKS
+# define MAXSYMLINKS 256
+#endif
char *
myrealpath(const char *path, char *resolved_path, int maxreslth) {
@@ -85,7 +82,7 @@ myrealpath(const char *path, char *resolved_path, int maxreslth) {
}
/* Protect against infinite loops. */
- if (readlinks++ > MAX_READLINKS) {
+ if (readlinks++ > MAXSYMLINKS) {
errno = ELOOP;
goto err;
}