Re: [PATCH] wcpncpy.3: fix incorrect return value.
From: Alejandro Colomar <alx@kernel.org>
Date: 2025-07-11 15:59:29
Attachments
- signature.asc [application/pgp-signature] 833 bytes
From: Alejandro Colomar <alx@kernel.org>
Date: 2025-07-11 15:59:29
Hi Elliott, On Fri, Jul 11, 2025 at 11:54:06AM -0400, enh wrote:
quoted
I didn't find any text in wcsncpy(3) similar to this. Maybe you read it elsewhere? It would be interesting to find the source, if it needs to be fixed.yeah, looks like i might have been copying from the wrong man page: ~/man-pages$ grep -r 'of the wide-character string' ./man/man3/wcsdup.3:contents is a duplicate of the wide-character string pointed to by ./man/man3/wcsncat.3:to the end of the wide-character string pointed ./man/man3/mbsrtowcs.3:up the converted part of the wide-character string, not including the ./man/man3/mbstowcs.3:up the converted part of the wide-character string, not including the ./man/man3/wcpcpy.3:returns a pointer to the end of the wide-character string ./man/man3/wcscat.3:to the end of the wide-character string pointed to by ./man/man3/wcsstr.3:It searches for the first occurrence of the wide-character string ./man/man3/wcstok.3:If the end of the wide-character string is now ./man/man3/wcslen.3:It determines the length of the wide-character string pointed to ./man/man3/mbsnrtowcs.3:that make up the converted part of the wide-character string, you are in a maze of twisty function names, all alike.
Ahhh, I suspect you got it from wcpcpy(3). That makes sense. As I told a friend recently, the 'n' in strncpy(3), stpncpy(3), strncat(3), strndup(3), and of course their wide-string counterparts, should be interpreted as "strings NO". :) Have a lovely day! Alex -- <https://www.alejandro-colomar.es/>