From a88d52237be23bb506950f7ecc70d2900aab61bb Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 9 May 2005 21:57:44 +0000 Subject: trim out useless defines and use some busybox funcs --- e2fsprogs/e2p/iod.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'e2fsprogs') diff --git a/e2fsprogs/e2p/iod.c b/e2fsprogs/e2p/iod.c index 808d3a3..5321f2d 100644 --- a/e2fsprogs/e2p/iod.c +++ b/e2fsprogs/e2p/iod.c @@ -15,9 +15,7 @@ */ #include "e2p.h" -#if HAVE_UNISTD_H #include -#endif #include #include @@ -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); } -- cgit v1.1