Re: strncpy clarify result may not be null terminated

Alejandro Colomar
2023-11-08T15:09:50Z

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

On Wed, Nov 08, 2023 at 09:59:11AM +0000, Thorsten Kukuk wrote:
> On Wed, Nov 08, Alejandro Colomar wrote:
>
> > strncpy(3) is useful to write to fixed-width buffers like `struct utmp`
> > and `struct utmpx`. Is there any other libc API that needs strncpy(3)?
> > Of those two APIs (utmp and utmpx) and any other that need strncpy(3),
> > are those deprecated, or is any such API still good for new code?
>

Hi Thorsten!

> Everything around utmp/utmpx/wtmp/lastlog is deprecated.

Is this a Linux-specific thing? Do you know if the BSDs also deprecated
utmpx?

Thanks,
Alex

>
> openSUSE Tumbleweed and MicroOS are no longer using nor supporting them
> and fresh installations don't have that files anymore.
> So new code should not use utmp/utmp/wtmp/lastlog anymore. Alternatives
> are e.g. systemd-logind/wtmpdb/lastlog2.

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