summaryrefslogblamecommitdiffstats
path: root/cpukit/libcsupport/src/readdir_r.c
blob: 7d598cd7e3533261d252f72b4642f9e23f70af3b (plain) (tree)
1
2
3
4
5
6
7
8
9
10





                                              



                   















                                                                      
/*
 *  readdir_r - reentrant version of readdir()
 *
 *  $Id$
 */

#if HAVE_CONFIG_H
#include "config.h"
#endif

#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;
}