diff options
Diffstat (limited to 'cpukit/libcsupport/src/readdir_r.c')
-rw-r--r-- | cpukit/libcsupport/src/readdir_r.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cpukit/libcsupport/src/readdir_r.c b/cpukit/libcsupport/src/readdir_r.c new file mode 100644 index 0000000000..9ddb84f97c --- /dev/null +++ b/cpukit/libcsupport/src/readdir_r.c @@ -0,0 +1,22 @@ +/* + * readdir_r - reentrant version of readdir() + * + * $Id$ + */ + +#include <sys/types.h> +#include <dirent.h> +#include <errno.h> +#include <stdio.h> + +/* + * The RTEMS version of readdir is already thread-safe. + */ + +int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) +{ + *result = readdir(dirp); + if (*result) + *entry = **result; + return *result ? 0 : errno; +} |