Linux Manual Pages development
 help / color / mirror / Atom feed
* [PATCH] man/man3/strncpy.3: Document lack of terminating null byte
@ 2026-10-30  2:59 Chan Lee
  2026-10-30 13:34 ` Alejandro Colomar
  0 siblings, 1 reply; 2+ messages in thread
From: Chan Lee @ 2026-10-30  2:59 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: linux-man, Chan Lee

The lack of a terminating null byte is already shown by the examples in
CAVEATS, but DESCRIPTION does not explain the condition under which it
happens.  A reader who only reads DESCRIPTION may miss this behavior.

This patch makes this behavior easier to discover by stating explicitly
that no terminating null byte is written when the source has dsize or
more non-null bytes.

Signed-off-by: Chan Lee <chanlee031012@gmail.com>
---
 man/man3/strncpy.3 | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/man/man3/strncpy.3 b/man/man3/strncpy.3
index 9c476acb4..89da260fe 100644
--- a/man/man3/strncpy.3
+++ b/man/man3/strncpy.3
@@ -26,6 +26,10 @@ into the array pointed to by
 .IR dst .
 If the source has too few non-null bytes to fill the destination,
 it pads the destination with trailing null bytes.
+If the source has
+.I dsize
+or more non-null bytes,
+no terminating null byte is written to the destination.
 If the destination buffer,
 limited by its size,
 isn't large enough to hold the copy,
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-30 13:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-30  2:59 [PATCH] man/man3/strncpy.3: Document lack of terminating null byte Chan Lee
2026-10-30 13:34 ` Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox