Re: strncpy clarify result may not be null terminated

Alejandro Colomar
2023-11-10T17:46:52Z

[-- Attachment #1: Type: text/plain, Size: 862 bytes --]

Hi Stefan,

On Fri, Nov 10, 2023 at 12:40:48PM +0200, Stefan Puiu wrote:
> Hi Alex,
>
> On Wed, Nov 8, 2023 at 9:33 PM Alejandro Colomar <alx@kernel.org> wrote:
> [.....]
> > strncpy(3):
> > CAVEATS
> > The name of these functions is confusing. These functions produce a
> > null‐padded character sequence, not a string (see string_copying(7)).
>
> I'm a bit confused by this distinction. Isn't a null-padded sequence
> technically also null-terminated? If there's a '0' at the end, then
> it's a string, in my understanding. Or was the intention to say "a
> character sequence that may be null-padded", where the case in which
> there's no padding at all being the reason for the distinction?

The latter. I'll check the wording.

Thanks!
Alex

>
> Thanks,
> Stefan.

--
<https://www.alejandro-colomar.es/>