]> err.no Git - util-linux/commitdiff
clean up realpath.[ch] includes and macros
authorKarel Zak <kzak@redhat.com>
Fri, 9 Feb 2007 16:35:15 +0000 (17:35 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 9 Feb 2007 16:35:15 +0000 (17:35 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
mount/realpath.c
mount/realpath.h
mount/swapon.c

index 373dbe82f5c50c68ce829e0a9d7d93d7a4f28f69..9dc517e4e33c0b79116953ef5042e5c3f6d3e659 100644 (file)
  * 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;
                }
index 206e53c10bea6d007f67acec9b666ac27ec8d25e..016fc4849b9bf3401312c866616a6505f20564fe 100644 (file)
@@ -1 +1,11 @@
+#ifndef REALPATH_H
+#define REALPATH_H
+
+#include <limits.h>
+#ifndef PATH_MAX
+# define PATH_MAX 4096
+#endif
+
 extern char *myrealpath(const char *path, char *resolved_path, int m);
+
+#endif /* REALPATH_H */
index ef8dcee90a146a04aa883547d6d23623ce3b3c99..b6bcd750fe38b067704f57d9a3614d0b890f313f 100644 (file)
 #include "mount_by_label.h"
 #include "realpath.h"
 
-#include <limits.h>             /* for PATH_MAX */
-#ifndef PATH_MAX
-#define PATH_MAX 8192
-#endif
-
 #define streq(s, t)    (strcmp ((s), (t)) == 0)
 
 #define        _PATH_FSTAB     "/etc/fstab"