diff options
author | jhb <jhb@FreeBSD.org> | 2014-07-11 16:16:26 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2014-07-11 16:16:26 +0000 |
commit | 4e6ab5e17ba0be3a6e6503ef839891ea18d775de (patch) | |
tree | a72bb3c64d43279b6eaf568a4cd2bf9745ccad27 /include/dirent.h | |
parent | 75acbf068af3ca9c40ed3d105ec7640ba4e858b9 (diff) | |
download | FreeBSD-src-4e6ab5e17ba0be3a6e6503ef839891ea18d775de.zip FreeBSD-src-4e6ab5e17ba0be3a6e6503ef839891ea18d775de.tar.gz |
Fix some edge cases with rewinddir():
- In the unionfs case, opendir() and fdopendir() read the directory's full
contents and cache it. This cache is not refreshed when rewinddir() is
called, so rewinddir() will not notice updates to a directory. Fix this
by splitting the code to fetch a directory's contents out of
__opendir_common() into a new _filldir() function and call this from
rewinddir() when operating on a unionfs directory.
- If rewinddir() is called on a directory opened with fdopendir() before
any directory entries are fetched, rewinddir() will not adjust the seek
location of the backing file descriptor. If the file descriptor passed
to fdopendir() had a non-zero offset, the rewinddir() will not rewind to
the beginning. Fix this by always seeking back to 0 in rewinddir().
This means the dd_rewind hack can also be removed.
While here, add missing locking to rewinddir().
CR: https://phabric.freebsd.org/D312
Reviewed by: jilles
MFC after: 1 week
Diffstat (limited to 'include/dirent.h')
-rw-r--r-- | include/dirent.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/dirent.h b/include/dirent.h index c77d844..b894bb8 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -63,6 +63,7 @@ typedef struct _dirdesc DIR; #define DTF_NODUP 0x0002 /* don't return duplicate names */ #define DTF_REWIND 0x0004 /* rewind after reading union stack */ #define __DTF_READALL 0x0008 /* everything has been read */ +#define __DTF_SKIPREAD 0x0010 /* assume internal buffer is populated */ #else /* !__BSD_VISIBLE */ |