]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
readlink.2: Emphasize that the returned buffer is not null-terminated
authorMichael Kerrisk <mtk.manpages@gmail.com>
Wed, 30 Dec 2020 13:55:38 +0000 (14:55 +0100)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Wed, 30 Dec 2020 13:55:38 +0000 (14:55 +0100)
Reported-by: Jonny Grant <jg@jguk.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
man2/readlink.2

index 6a1767caa186d9103b512d3e6619d78f902ac86d..a078deb4f272bbfb7967d91873ef4e29a33abbe2 100644 (file)
@@ -93,7 +93,7 @@ in the buffer
 which has size
 .IR bufsiz .
 .BR readlink ()
-does not append a null byte to
+does not append a terminating null byte to
 .IR buf .
 It will (silently) truncate the contents (to a length of
 .I bufsiz
@@ -332,6 +332,8 @@ main(int argc, char *argv[])
         exit(EXIT_FAILURE);
     }
 
+    /* Print only \(aqnbytes\(aq of \(aqbuf\(aq, as it doesn't contain a terminating
+       null byte (\(aq\e0\(aq). */
     printf("\(aq%s\(aq points to \(aq%.*s\(aq\en", argv[1], (int) nbytes, buf);
 
     /* If the return value was equal to the buffer size, then the