+++ This bug was initially created as a clone of Bug #1741515 +++ This file should compile without warnings using -O2 -Wall, using GCC 9 (or later): #include <string.h> #include <utmp.h> #include <utmpx.h> void write_utmp (struct utmp *p, const char *data) { strncpy (p->ut_line, data, sizeof (p->ut_line)); strncpy (p->ut_id, data, sizeof (p->ut_id)); strncpy (p->ut_user, data, sizeof (p->ut_user)); strncpy (p->ut_host, data, sizeof (p->ut_host)); } void write_utmpx (struct utmpx *p, const char *data) { strncpy (p->ut_line, data, sizeof (p->ut_line)); strncpy (p->ut_id, data, sizeof (p->ut_id)); strncpy (p->ut_user, data, sizeof (p->ut_user)); strncpy (p->ut_host, data, sizeof (p->ut_host)); } Since the suppression of warnings in system headers is not effective here, I think we should backport the upstream fixes to support GCC Toolset 9 and later.
The fix for this issue will naturally be part of bug 1749439. *** This bug has been marked as a duplicate of bug 1749439 ***