Bug 1741516 - glibc: Add nonstring attributes to <utmp.h>, <utmpx.h>
Summary: glibc: Add nonstring attributes to <utmp.h>, <utmpx.h>
Keywords:
Status: CLOSED DUPLICATE of bug 1749439
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: glibc
Version: 8.1
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: 8.2
Assignee: glibc team
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks: 1741515
TreeView+ depends on / blocked
 
Reported: 2019-08-15 11:04 UTC by Florian Weimer
Modified: 2023-07-18 14:30 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1741515
Environment:
Last Closed: 2019-11-07 16:23:28 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

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 ***


Note You need to log in before you can comment on or make changes to this bug.