mirror of https://github.com/mkerrisk/man-pages
readdir.3: Minor tweaks to 'd_name' text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
307b34a803
commit
0fdfbd140d
|
@ -273,13 +273,16 @@ characters preceding the terminating null byte (\(aq\\0\(aq).
|
|||
POSIX.1 explicitly notes that this field should not be used as an lvalue.
|
||||
The standard also notes that the use of
|
||||
.I sizeof(d_name)
|
||||
(and by implication
|
||||
.IR "sizeof(struct dirent)" )
|
||||
is incorrect; use
|
||||
.IR strlen(d_name)
|
||||
instead.
|
||||
(On some systems, this field is defined as
|
||||
.IR char\ d_name[1] !)
|
||||
By implication, the use
|
||||
.IR "sizeof(struct dirent)"
|
||||
to capture the size of record including the size of
|
||||
.IR d_name
|
||||
is also incorrect.
|
||||
|
||||
Note that while the call
|
||||
|
||||
|
@ -290,11 +293,11 @@ on some filesystems (e.g., CIFS, Windows SMB servers),
|
|||
the null-terminated filename that is (correctly) returned in
|
||||
.I d_name
|
||||
can actually exceed this size.
|
||||
(In such cases, the
|
||||
In such cases, the
|
||||
.I d_reclen
|
||||
field will contain a value that exceeds the size of the glibc
|
||||
.I dirent
|
||||
structure shown above.)
|
||||
structure shown above.
|
||||
.SH SEE ALSO
|
||||
.BR getdents (2),
|
||||
.BR read (2),
|
||||
|
|
Loading…
Reference in New Issue