Ambiguity in memccpy() description, with patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The current description in the memccpy.3 man page:

       The memccpy() function copies no more than n bytes from memory
area src to memory area dest, stopping when the character c is found.

       If the memory areas overlap, the results are undefined.

doesn't clearly say whether the final character c is copied or not. (It is.)

This patch copies the description from POSIX
https://pubs.opengroup.org/onlinepubs/9699919799/functions/memccpy.html
with the parameter names and added paragraph break retained from the
current version. The updated description is:

       The memccpy() function copies bytes from memory area src into
dest, stopping after the first occurrence of byte c (converted to an
unsigned char) is copied, or after n bytes are copied, whichever comes
first.

       If copying takes place between objects that overlap, the
behavior is undefined.

I have not (yet) checked whether there are similar ambiguities in
other man pages.

Patch follows:

diff --git man/man3/memccpy.3 man/man3/memccpy.3
index 0ba805176..057890f7e 100644
--- man/man3/memccpy.3
+++ man/man3/memccpy.3
@@ -23,20 +23,22 @@ Standard C library
 .fi
 .SH DESCRIPTION
 The
-.BR memccpy ()
-function copies no more than
-.I n
-bytes from
-memory area
+.BR memccpy()
+function copies bytes from memory area
 .I src
-to memory area
+into
 .IR dest ,
-stopping when the
-character
+stopping after the first occurrence of byte
 .I c
-is found.
+(converted to an
+.BR "unsigned char" )
+is copied, or after
+.I n
+bytes are copied, whichever
+comes first.
 .P
-If the memory areas overlap, the results are undefined.
+If copying takes place between objects that overlap,
+the behavior is undefined.
 .SH RETURN VALUE
 The
 .BR memccpy ()




[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux