From: Jim Meyering Date: Sun, 18 Apr 2004 15:02:49 +0000 (+0000) Subject: (print_user): Use xrealloc here, rather than unchecked realloc. X-Git-Tag: v5.3.0~1747 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6bb27087a1e67b297ab1074b614782f073adb2b6;p=thirdparty%2Fcoreutils.git (print_user): Use xrealloc here, rather than unchecked realloc. Remove anachronistic casts. --- diff --git a/src/who.c b/src/who.c index 184a8cb703..1336510f34 100644 --- a/src/who.c +++ b/src/who.c @@ -390,7 +390,7 @@ print_user (const STRUCT_UTMP *utmp_ent) if (hostlen < strlen (host) + strlen (display) + 4) { hostlen = strlen (host) + strlen (display) + 4; - hoststr = (char *) realloc (hoststr, hostlen); + hoststr = xrealloc (hoststr, hostlen); } sprintf (hoststr, "(%s:%s)", host, display); } @@ -399,7 +399,7 @@ print_user (const STRUCT_UTMP *utmp_ent) if (hostlen < strlen (host) + 3) { hostlen = strlen (host) + 3; - hoststr = (char *) realloc (hoststr, hostlen); + hoststr = xrealloc (hoststr, hostlen); } sprintf (hoststr, "(%s)", host); } @@ -409,7 +409,7 @@ print_user (const STRUCT_UTMP *utmp_ent) if (hostlen < 1) { hostlen = 1; - hoststr = (char *) realloc (hoststr, hostlen); + hoststr = xrealloc (hoststr, hostlen); } stpcpy (hoststr, ""); }