who -r: don't print "last=" when the corresponding byte is unprintable
authorJim Meyering <meyering@redhat.com>
Fri, 4 Jul 2008 14:34:39 +0000 (16:34 +0200)
committerJim Meyering <meyering@redhat.com>
Fri, 4 Jul 2008 14:34:39 +0000 (16:34 +0200)
* src/who.c (print_runlevel): Print last=%c only when the "preceding
run-level" byte is printable.  Reported by Gian Piero De Lolliis in
<http://bugzilla.redhat.com/453249>.

src/who.c

index 5529618..0bba912 100644 (file)
--- a/src/who.c
+++ b/src/who.c
@@ -30,6 +30,7 @@
 #include <sys/types.h>
 #include "system.h"
 
+#include "c-ctype.h"
 #include "canon-host.h"
 #include "readutmp.h"
 #include "error.h"
@@ -511,7 +512,7 @@ print_runlevel (const STRUCT_UTMP *utmp_ent)
   sprintf (comment, "%s%c", _("last="), (last == 'N') ? 'S' : last);
 
   print_line (-1, "", ' ', -1, runlevline, time_string (utmp_ent),
-             "", "", comment, "");
+             "", "", c_isprint (last) ? comment : "", "");
 
   return;
 }