Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Aug 2022 09:03:23 +0000
From:      "Piotr P. Stefaniak" <pstef@freebsd.org>
To:        Vladimir Kondratyev <wulf@freebsd.org>
Cc:        dev-commits-src-main@freebsd.org
Subject:   Re: git: 019391bf8527 - main - LinuxKPI: Implement strscpy
Message-ID:  <Ywnd29WzrEg85tUH@freefall.freebsd.org>
In-Reply-To: <202107050023.1650Nmn3022660@gitrepo.freebsd.org>
References:  <202107050023.1650Nmn3022660@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2021-07-05 00:23:48, Vladimir Kondratyev wrote:
>URL: https://cgit.FreeBSD.org/src/commit/?id=019391bf852771070cb739900f9e20ae6c41c746
>    LinuxKPI: Implement strscpy
>
>    strscpy copies the src string, or as much of it as fits, into the
>    dst buffer.  The dst buffer is always NUL terminated, unless it's
>    zero-sized.  strscpy returns the number of characters copied (not
>    including the trailing NUL) or -E2BIG if len is 0 or src was
>    truncated.
>
>    Currently drm-kmod replaces strscpy with strncpy that is not quite
>    correct as strncpy does not NUL-terminate truncated strings and
>    returns different values on exit.

Seems like an overall useful function, maybe it deserves wider
availability via libc?

Piotr



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Ywnd29WzrEg85tUH>