]> git.ipfire.org Git - thirdparty/util-linux.git/commit
last: fix false positive compiler warning
authorSami Kerola <kerolasa@iki.fi>
Thu, 3 May 2018 21:57:59 +0000 (22:57 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 10 May 2018 09:29:17 +0000 (11:29 +0200)
commite4077e0e445ddc8d81e4fbab599655bb48ac130a
treeb6adcfcaae3a2d592a14268c0701b9ae5b844faf
parent8fd27bec0c5cb5ade55cf0a9d606aa1dbeeed95f
last: fix false positive compiler warning

login-utils/last.c: In function ‘list’:
login-utils/last.c:398:36: warning: argument to ‘sizeof’ in ‘strncat’ call
is the same expression as the source; did you mean to use the size of the
destination?  [-Wsizeof-pointer-memaccess]
  strncat(utline, p->ut_line, sizeof(p->ut_line));

The sizeof(utline) is defined as sizeof(p->ut_line) + 1, so the compiler got
that wrong.  Lets truncate strncat() otherway around to keep gcc 8.1 happy.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
login-utils/last.c