diff options
author | Karel Zak | 2007-02-09 17:35:15 +0100 |
---|---|---|
committer | Karel Zak | 2007-02-09 17:35:15 +0100 |
commit | 4717ea4a97af59fca6a88a84e10add5d9539a473 (patch) | |
tree | 9476e2554229ad30658927647186d68a6c121dd9 /mount | |
parent | swapon: does not correctly deal with symlinks (diff) | |
download | kernel-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')
-rw-r--r-- | mount/realpath.c | 11 | ||||
-rw-r--r-- | mount/realpath.h | 10 | ||||
-rw-r--r-- | mount/swapon.c | 5 |
3 files changed, 14 insertions, 12 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; } diff --git a/mount/realpath.h b/mount/realpath.h index 206e53c10..016fc4849 100644 --- a/mount/realpath.h +++ b/mount/realpath.h @@ -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 */ diff --git a/mount/swapon.c b/mount/swapon.c index ef8dcee90..b6bcd750f 100644 --- a/mount/swapon.c +++ b/mount/swapon.c @@ -19,11 +19,6 @@ #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" |