Linux Manual Pages development
 help / color / mirror / Atom feed
From: Chan Lee <chanlee031012@gmail.com>
To: Alejandro Colomar <alx+linux-man@kernel.org>
Cc: linux-man@vger.kernel.org, Chan Lee <chanlee031012@gmail.com>
Subject: [PATCH] man/man3/strncpy.3: Document lack of terminating null byte
Date: Thu, 29 Oct 2026 22:59:27 -0400	[thread overview]
Message-ID: <20261030025927.37758-1-chanlee031012@gmail.com> (raw)

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)


             reply	other threads:[~2026-10-30  2:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30  2:59 Chan Lee [this message]
2026-10-30 13:34 ` [PATCH] man/man3/strncpy.3: Document lack of terminating null byte Alejandro Colomar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261030025927.37758-1-chanlee031012@gmail.com \
    --to=chanlee031012@gmail.com \
    --cc=alx+linux-man@kernel.org \
    --cc=linux-man@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox