From 0fdfbd140ded6d82c802864bf61d728d9d30ad6d Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Wed, 2 Mar 2016 12:25:51 +0100 Subject: [PATCH] readdir.3: Minor tweaks to 'd_name' text Signed-off-by: Michael Kerrisk --- man3/readdir.3 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/man3/readdir.3 b/man3/readdir.3 index f209c4996..a080e606d 100644 --- a/man3/readdir.3 +++ b/man3/readdir.3 @@ -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),