Bug 1741516

Summary: glibc: Add nonstring attributes to <utmp.h>, <utmpx.h>
Product: Red Hat Enterprise Linux 8 Reporter: Florian Weimer <fweimer>
Component: glibcAssignee: glibc team <glibc-bugzilla>
Status: CLOSED DUPLICATE QA Contact: qe-baseos-tools-bugs
Severity: low Docs Contact:
Priority: low    
Version: 8.1CC: ashankar, codonell, dj, fweimer, glibc-bugzilla, mnewsome, pfrankli, qe-baseos-tools-bugs
Target Milestone: rcKeywords: Triaged
Target Release: 8.2   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1741515 Environment:
Last Closed: 2019-11-07 16:23:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1741515    

Description Florian Weimer 2019-08-15 11:04:36 UTC
+++ 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.

Comment 1 Florian Weimer 2019-11-07 16:23:28 UTC
The fix for this issue will naturally be part of bug 1749439.

*** This bug has been marked as a duplicate of bug 1749439 ***