From: Collin Funk Date: Sat, 28 Mar 2026 19:45:14 +0000 (-0700) Subject: who: avoid locking standard output for each user with the -q option X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eec7b2a131f32cf75891a8ebf9e90d2e45195491;p=thirdparty%2Fcoreutils.git who: avoid locking standard output for each user with the -q option * src/who (list_entries_who): Prefer putchar and fputs to printf. Simplify separator tracking. --- diff --git a/src/who.c b/src/who.c index 226e9ceb1f..b12a31442a 100644 --- a/src/who.c +++ b/src/who.c @@ -525,7 +525,6 @@ static void list_entries_who (idx_t n, STRUCT_UTMP const *utmp_buf) { idx_t entries = 0; - char const *separator = ""; while (n--) { @@ -535,9 +534,10 @@ list_entries_who (idx_t n, STRUCT_UTMP const *utmp_buf) trimmed_name = extract_trimmed_name (utmp_buf); - printf ("%s%s", separator, trimmed_name); + if (entries) + putchar (' '); + fputs (trimmed_name, stdout); free (trimmed_name); - separator = " "; entries++; } utmp_buf++;