summaryrefslogtreecommitdiff
path: root/src/who.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-05-14 13:49:35 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2018-05-14 13:49:58 -0700
commitf6cb50cc991d461f443ea3afc517c9e1e37ef496 (patch)
treefadc00bf2815a976811bf64a397ffd8c5db1a56e /src/who.c
parentea7ae28b10edc146f415eab05dd55326cfd69032 (diff)
downloadcoreutils-f6cb50cc991d461f443ea3afc517c9e1e37ef496.tar.gz
who: simplify port to GCC 8
* src/who.c (make_id_equals_comment): Use simpler workaround for GCC bug 85602. Suggested by Martin Sebor in: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85602#c3
Diffstat (limited to 'src/who.c')
-rw-r--r--src/who.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/who.c b/src/who.c
index 3719baec5..1bfe4f11d 100644
--- a/src/who.c
+++ b/src/who.c
@@ -447,14 +447,11 @@ print_boottime (const STRUCT_UTMP *utmp_ent)
static char *
make_id_equals_comment (STRUCT_UTMP const *utmp_ent)
{
- char const *ideq = _("id=");
- char const *ut_id = UT_ID (utmp_ent);
- size_t ideqlen = strlen (ideq);
- size_t ut_idlen = strnlen (ut_id, sizeof UT_ID (utmp_ent));
- char *comment = xmalloc (ideqlen + ut_idlen + 1);
- char *rhs = mempcpy (comment, ideq, ideqlen);
- char *z = mempcpy (rhs, ut_id, ut_idlen);
- *z = '\0';
+ size_t utmpsize = sizeof UT_ID (utmp_ent);
+ char *comment = xmalloc (strlen (_("id=")) + utmpsize + 1);
+
+ strcpy (comment, _("id="));
+ strncat (comment, UT_ID (utmp_ent), utmpsize);
return comment;
}