Redefine readdir() on IsoFileSource, to skip "." and ".." dirs.
This commit is contained in:
parent
008871cfd8
commit
0306bb5daf
@ -281,6 +281,8 @@ int lfs_readdir(IsoFileSource *src, IsoFileSource **child)
|
|||||||
size_t a, b;
|
size_t a, b;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
/* while to skip "." and ".." dirs */
|
||||||
|
while (1) {
|
||||||
entry = readdir(data->info.dir);
|
entry = readdir(data->info.dir);
|
||||||
if (entry == NULL) {
|
if (entry == NULL) {
|
||||||
if (errno == EBADF)
|
if (errno == EBADF)
|
||||||
@ -288,6 +290,10 @@ int lfs_readdir(IsoFileSource *src, IsoFileSource **child)
|
|||||||
else
|
else
|
||||||
return 0; /* EOF */
|
return 0; /* EOF */
|
||||||
}
|
}
|
||||||
|
if (strcmp(entry->d_name,".") && strcmp(entry->d_name,"..")) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* constructs the new path */
|
/* constructs the new path */
|
||||||
a = strlen(data->path);
|
a = strlen(data->path);
|
||||||
|
@ -153,6 +153,8 @@ struct Iso_File_Source
|
|||||||
* The dir must be open() before calling this, and close() when no more
|
* The dir must be open() before calling this, and close() when no more
|
||||||
* needed. Only valid for dirs.
|
* needed. Only valid for dirs.
|
||||||
*
|
*
|
||||||
|
* Note that "." and ".." children MUST NOT BE returned.
|
||||||
|
*
|
||||||
* @param child
|
* @param child
|
||||||
* pointer to be filled with the given child. Undefined on error or OEF
|
* pointer to be filled with the given child. Undefined on error or OEF
|
||||||
* @return
|
* @return
|
||||||
|
Loading…
Reference in New Issue
Block a user