diff options
author | Thomas Jarosch <tomj@simonv.com> | 2011-06-10 16:29:55 +0000 |
---|---|---|
committer | Thomas Jarosch <tomj@simonv.com> | 2011-06-10 16:29:55 +0000 |
commit | a87e395edf2e7f93f84750511c22885fb8e5f07e (patch) | |
tree | c952a695189cdd194f42c1713c3eef282de5da19 | |
parent | 986a92fe6667d1946f0017570abfa1487157be70 (diff) | |
download | rockbox-a87e395edf2e7f93f84750511c22885fb8e5f07e.tar.gz 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
-rw-r--r-- | uisimulator/common/io.c | 16 |
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 @@ | |||
25 | #include <stdarg.h> | 25 | #include <stdarg.h> |
26 | #include <sys/stat.h> | 26 | #include <sys/stat.h> |
27 | #include <time.h> | 27 | #include <time.h> |
28 | #include <errno.h> | ||
28 | #include "config.h" | 29 | #include "config.h" |
29 | 30 | ||
30 | #define HAVE_STATVFS (!defined(WIN32)) | 31 | #define HAVE_STATVFS (!defined(WIN32)) |
@@ -328,8 +329,11 @@ struct sim_dirent *sim_readdir(MYDIR *dir) | |||
328 | char buffer[MAX_PATH]; /* sufficiently big */ | 329 | char buffer[MAX_PATH]; /* sufficiently big */ |
329 | static struct sim_dirent secret; | 330 | static struct sim_dirent secret; |
330 | STAT_T s; | 331 | STAT_T s; |
331 | DIRENT_T *x11 = READDIR(dir->dir); | ||
332 | struct tm tm; | 332 | struct tm tm; |
333 | DIRENT_T *x11; | ||
334 | |||
335 | read_next: | ||
336 | x11 = READDIR(dir->dir); | ||
333 | 337 | ||
334 | if(!x11) | 338 | if(!x11) |
335 | return (struct sim_dirent *)0; | 339 | return (struct sim_dirent *)0; |
@@ -339,8 +343,18 @@ struct sim_dirent *sim_readdir(MYDIR *dir) | |||
339 | /* build file name */ | 343 | /* build file name */ |
340 | snprintf(buffer, sizeof(buffer), "%s/%s", | 344 | snprintf(buffer, sizeof(buffer), "%s/%s", |
341 | get_sim_pathname(dir->name), secret.d_name); | 345 | get_sim_pathname(dir->name), secret.d_name); |
346 | |||
342 | if (STAT(buffer, &s)) /* get info */ | 347 | if (STAT(buffer, &s)) /* get info */ |
348 | { | ||
349 | /* File size larger than 2 GB? */ | ||
350 | if (errno == EOVERFLOW) | ||
351 | { | ||
352 | DEBUGF("stat() overflow for %s. Skipping\n", buffer); | ||
353 | goto read_next; | ||
354 | } | ||
355 | |||
343 | return NULL; | 356 | return NULL; |
357 | } | ||
344 | 358 | ||
345 | #define ATTR_DIRECTORY 0x10 | 359 | #define ATTR_DIRECTORY 0x10 |
346 | 360 | ||