diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-05-09 21:57:44 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-05-09 21:57:44 +0000 |
commit | a88d52237be23bb506950f7ecc70d2900aab61bb (patch) | |
tree | c83f170ec95bbc72644d8cfd92df746458a8bb41 /e2fsprogs | |
parent | 507d1f76e5cbc74646a967b9ed7599dbd2d8eb88 (diff) | |
download | busybox-a88d52237be23bb506950f7ecc70d2900aab61bb.tar.gz |
trim out useless defines and use some busybox funcs
Diffstat (limited to 'e2fsprogs')
-rw-r--r-- | e2fsprogs/e2p/iod.c | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/e2fsprogs/e2p/iod.c b/e2fsprogs/e2p/iod.c index 808d3a39d..5321f2da1 100644 --- a/e2fsprogs/e2p/iod.c +++ b/e2fsprogs/e2p/iod.c @@ -15,9 +15,7 @@ */ #include "e2p.h" -#if HAVE_UNISTD_H #include <unistd.h> -#endif #include <stdlib.h> #include <string.h> @@ -27,27 +25,10 @@ int iterate_on_dir (const char * dir_name, { DIR * dir; struct dirent *de, *dep; - int max_len = -1, len; + int max_len, len; -#if HAVE_PATHCONF && defined(_PC_NAME_MAX) - max_len = pathconf(dir_name, _PC_NAME_MAX); -#endif - if (max_len == -1) { -#ifdef _POSIX_NAME_MAX - max_len = _POSIX_NAME_MAX; -#else -#ifdef NAME_MAX - max_len = NAME_MAX; -#else - max_len = 256; -#endif /* NAME_MAX */ -#endif /* _POSIX_NAME_MAX */ - } - max_len += sizeof(struct dirent); - - de = malloc(max_len+1); - if (!de) - return -1; + max_len = PATH_MAX + sizeof(struct dirent); + de = (struct dirent *)xmalloc(max_len+1); memset(de, 0, max_len+1); dir = opendir (dir_name); @@ -57,12 +38,10 @@ int iterate_on_dir (const char * dir_name, } while ((dep = readdir (dir))) { len = sizeof(struct dirent); -#ifdef HAVE_RECLEN_DIRENT if (len < dep->d_reclen) len = dep->d_reclen; if (len > max_len) len = max_len; -#endif memcpy(de, dep, len); (*func) (dir_name, de, private); } |