seekdir.c 270 B

123456789101112131415
  1. #include <dirent.h>
  2. #include <errno.h>
  3. #include <unistd.h>
  4. #include "dirstream.h"
  5. void seekdir(DIR * dir, long int offset)
  6. {
  7. if (!dir) {
  8. __set_errno(EBADF);
  9. return;
  10. }
  11. dir->dd_nextoff = lseek(dir->dd_fd, offset, SEEK_SET);
  12. dir->dd_size = dir->dd_nextloc = 0;
  13. }