From 5e4e32923d0074647e1db463f931bfc9b69a4f10 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 14 Nov 2013 19:02:35 +0000 Subject: Can just use scandir now. --- content/fetchers/file.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'content') diff --git a/content/fetchers/file.c b/content/fetchers/file.c index 7c87a905b..4fe1c9867 100644 --- a/content/fetchers/file.c +++ b/content/fetchers/file.c @@ -503,21 +503,13 @@ static void fetch_file_process_dir(struct fetch_file_context *ctx, char datebuf[64]; /* buffer for date text */ char timebuf[64]; /* buffer for time text */ char urlpath[PATH_MAX]; /* buffer for leaf entry path */ - struct dirent *ent; /* current directroy entry */ - -#ifdef HAVE_SCANDIR + struct dirent *ent; /* current directory entry */ struct dirent **listing = NULL; /* directory entry listing */ int i; /* directory entry index */ int n; /* number of directory entries */ n = scandir(ctx->path, &listing, 0, alphasort); if (n < 0) { -#else - DIR *scandir; /* handle for enumerating the directory */ - - scandir = opendir(ctx->path); - if (scandir == NULL) { -#endif fetch_file_process_error(ctx, fetch_file_errno_to_http_code(errno)); return; @@ -575,12 +567,8 @@ static void fetch_file_process_dir(struct fetch_file_context *ctx, if (fetch_file_send_callback(&msg, ctx)) goto fetch_file_process_dir_aborted; -#ifdef HAVE_SCANDIR for (i = 0; i < n; i++) { ent = listing[i]; -#else - while ((ent = readdir(scandir)) != NULL) { -#endif if (ent->d_name[0] == '.') continue; @@ -665,16 +653,12 @@ static void fetch_file_process_dir(struct fetch_file_context *ctx, fetch_file_process_dir_aborted: -#ifdef HAVE_SCANDIR if (listing != NULL) { for (i = 0; i < n; i++) { free(listing[i]); } free(listing); } -#else - closedir(scandir); -#endif } -- cgit v1.2.3