summaryrefslogtreecommitdiffstats
path: root/uisimulator
diff options
context:
space:
mode:
authorThomas Jarosch <tomj@simonv.com>2011-06-10 16:29:55 +0000
committerThomas Jarosch <tomj@simonv.com>2011-06-10 16:29:55 +0000
commita87e395edf2e7f93f84750511c22885fb8e5f07e (patch)
treec952a695189cdd194f42c1713c3eef282de5da19 /uisimulator
parent986a92fe6667d1946f0017570abfa1487157be70 (diff)
downloadrockbox-a87e395edf2e7f93f84750511c22885fb8e5f07e.tar.gz
rockbox-a87e395edf2e7f93f84750511c22885fb8e5f07e.tar.bz2
rockbox-a87e395edf2e7f93f84750511c22885fb8e5f07e.zip
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
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/common/io.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c
index 3212fa50fe..2195a5e86f 100644
--- a/uisimulator/common/io.c
+++ b/uisimulator/common/io.c
@@ -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