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:
parent
986a92fe66
commit
a87e395edf
1 changed files with 15 additions and 1 deletions
|
@ -25,6 +25,7 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <errno.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#define HAVE_STATVFS (!defined(WIN32))
|
#define HAVE_STATVFS (!defined(WIN32))
|
||||||
|
@ -328,8 +329,11 @@ struct sim_dirent *sim_readdir(MYDIR *dir)
|
||||||
char buffer[MAX_PATH]; /* sufficiently big */
|
char buffer[MAX_PATH]; /* sufficiently big */
|
||||||
static struct sim_dirent secret;
|
static struct sim_dirent secret;
|
||||||
STAT_T s;
|
STAT_T s;
|
||||||
DIRENT_T *x11 = READDIR(dir->dir);
|
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
|
DIRENT_T *x11;
|
||||||
|
|
||||||
|
read_next:
|
||||||
|
x11 = READDIR(dir->dir);
|
||||||
|
|
||||||
if(!x11)
|
if(!x11)
|
||||||
return (struct sim_dirent *)0;
|
return (struct sim_dirent *)0;
|
||||||
|
@ -339,8 +343,18 @@ struct sim_dirent *sim_readdir(MYDIR *dir)
|
||||||
/* build file name */
|
/* build file name */
|
||||||
snprintf(buffer, sizeof(buffer), "%s/%s",
|
snprintf(buffer, sizeof(buffer), "%s/%s",
|
||||||
get_sim_pathname(dir->name), secret.d_name);
|
get_sim_pathname(dir->name), secret.d_name);
|
||||||
|
|
||||||
if (STAT(buffer, &s)) /* get info */
|
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;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
#define ATTR_DIRECTORY 0x10
|
#define ATTR_DIRECTORY 0x10
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue