1
0
Fork 0
forked from len0rd/rockbox

RaaA / sim: Don't abort directory read if we encounter files larger than 2 GB in a directory

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29992 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Jarosch 2011-06-10 16:29:55 +00:00
parent 986a92fe66
commit a87e395edf

View file

@ -25,6 +25,7 @@
#include <stdarg.h>
#include <sys/stat.h>
#include <time.h>
#include <errno.h>
#include "config.h"
#define HAVE_STATVFS (!defined(WIN32))
@ -328,8 +329,11 @@ struct sim_dirent *sim_readdir(MYDIR *dir)
char buffer[MAX_PATH]; /* sufficiently big */
static struct sim_dirent secret;
STAT_T s;
DIRENT_T *x11 = READDIR(dir->dir);
struct tm tm;
DIRENT_T *x11;
read_next:
x11 = READDIR(dir->dir);
if(!x11)
return (struct sim_dirent *)0;
@ -339,8 +343,18 @@ struct sim_dirent *sim_readdir(MYDIR *dir)
/* build file name */
snprintf(buffer, sizeof(buffer), "%s/%s",
get_sim_pathname(dir->name), secret.d_name);
if (STAT(buffer, &s)) /* get info */
{
/* File size larger than 2 GB? */
if (errno == EOVERFLOW)
{
DEBUGF("stat() overflow for %s. Skipping\n", buffer);
goto read_next;
}
return NULL;
}
#define ATTR_DIRECTORY 0x10