Hi Collin,
> process.c:224:50: warning: argument to 'sizeof' in 'strncmp' call is the same
> expression as the first source; did you mean to provide an explicit length?
> [-Wsizeof-pointer-memaccess]
> 224 | if (!strncmp (UT_USER (uptr), name, sizeof (UT_USER (uptr))))
> | ^
>
> And again:
>
> syslogd.c:1648:43: warning: argument to 'sizeof' in 'strncpy' call is the
> same expression as the source; did you mean to provide an explicit length?
> [-Wsizeof-pointer-memaccess]
> 1648 | strncpy (line, utp->ut_line, sizeof (utp->ut_line));
> | ^
> syslogd.c:1666:30: warning: argument to 'sizeof' in 'strncmp' call is the
> same expression as the second source; did you mean to provide an explicit
> length? [-Wsizeof-pointer-memaccess]
> 1666 | sizeof (UT_USER (utp))))
> | ^
>
> I've been meaning to fix these after noticing them recently, but I'm not
> very familiar with readutmp. Perhaps this code was for ancient versions
> of the module?
Definitely, yes. The gnulib/NEWS entries:
2023-08-08 readutmp The result element type of the function read_utmp,
STRUCT_UTMP, is no longer the same as the result
value type of the function getutxent, struct utmpx.
2023-08-03 readutmp Some STRUCT_UTMP members can be char *,
2023-08-01 rather than fixed-length char arrays.
On some platforms, the timestamp is ut_ts of type
struct timespec, not ut_tv of type struct timeval,
and ut_session is pid_t not long.
read_utmp's 2nd arg is now idx_t * not size_t *.
Link additionally with $(READUTMP_LIB).
Basically, before these changes, using readutmp implied platform-dependent
code and #ifs. Now, the API is the same on all platforms, no #ifs needed any
more. But it requires some code changes (mostly simplifications) on the
inetutils side.
Bruno