{
DIR *dir;
struct dirent *entry;
- char path[MAX_PATH_LENGTH];
- static char dirent_buffer[sizeof(struct dirent) + PATH_MAX + 1] = {0,};
- static struct dirent *dirent_r = (struct dirent *)dirent_buffer;
+ char path[MAX_PATH_LENGTH + 1]; /* Add +1 for '%s/%s' format*/
dir = opendir(dirname);
if (dir == NULL)
return -1;
- while ((readdir_r(dir, dirent_r, &entry) == 0) && entry) {
+ while ((entry = readdir(dir))) {
if (strcmp(entry->d_name, ".") && strcmp(entry->d_name, "..")) {
- snprintf(path, (size_t) MAX_PATH_LENGTH, "%s/%s",
+ snprintf(path, sizeof(path), "%s/%s",
dirname, entry->d_name);
if (entry->d_type != DT_DIR)
unlink(path);
- }
+ }
}
closedir(dir);
return ret;
}
-HANDLER_WRAPPERS(file_feature, int, _IO_getc, _IO_FILE*, stream)
+HANDLER_WRAPPERS(file_feature, int, _IO_getc, FILE*, stream)
{
- int (*getcp)(_IO_FILE* stream);
+ int (*getcp)(FILE* stream);
BEFORE_ORIGINAL_START_END_FILEP(API_ID_getc, 'd', _IO_getc, LIBC,
stream, FD_API_READ_START, "p",
return ret;
}
-HANDLER_WRAPPERS(file_feature, int, _IO_putc, int, character, _IO_FILE*, stream)
+HANDLER_WRAPPERS(file_feature, int, _IO_putc, int, character, FILE*, stream)
{
- int (*_IO_putcp)(int character, _IO_FILE* stream);
+ int (*_IO_putcp)(int character, FILE* stream);
BEFORE_ORIGINAL_START_END_FILEP(API_ID_putc, 'd', _IO_putc, LIBC,
stream, FD_API_WRITE_START, "dp",