rewinddir.c 320 B

12345678910111213141516
  1. #include <dirent.h>
  2. #include <errno.h>
  3. #include <unistd.h>
  4. #include "dirstream.h"
  5. /* rewinddir() just does an lseek(fd,0,0) - see close for comments */
  6. void rewinddir(DIR * dir)
  7. {
  8. if (!dir) {
  9. __set_errno(EBADF);
  10. return;
  11. }
  12. lseek(dir->dd_fd, 0, SEEK_SET);
  13. dir->dd_nextoff = dir->dd_nextloc = dir->dd_size = 0;
  14. }