diff options
author | Sami Kerola | 2013-08-17 20:15:12 +0200 |
---|---|---|
committer | Karel Zak | 2013-08-23 10:58:51 +0200 |
commit | 2e58cd407e41937f7ca82a19577ac0198d77cceb (patch) | |
tree | 62d8df7b46cc7a56c81adf5ed8767e623c8b50d4 /login-utils/last.c | |
parent | include: carefulput: print determined char when unprintable char is found (diff) | |
download | kernel-qcow2-util-linux-2e58cd407e41937f7ca82a19577ac0198d77cceb.tar.gz kernel-qcow2-util-linux-2e58cd407e41937f7ca82a19577ac0198d77cceb.tar.xz kernel-qcow2-util-linux-2e58cd407e41937f7ca82a19577ac0198d77cceb.zip |
last: use carefulput() for printable character output
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'login-utils/last.c')
-rw-r--r-- | login-utils/last.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/login-utils/last.c b/login-utils/last.c index 0f475f2cf..f08632bbf 100644 --- a/login-utils/last.c +++ b/login-utils/last.c @@ -45,6 +45,7 @@ #include "pathnames.h" #include "xalloc.h" #include "closestream.h" +#include "carefulputc.h" #ifndef SHUTDOWN_TIME # define SHUTDOWN_TIME 254 @@ -396,12 +397,8 @@ static int list(struct utmp *p, time_t t, int what) /* * Print out "final" string safely. */ - for (s = final; *s; s++) { - if (*s == '\n' || (*s >= 32 && (unsigned char)*s <= 126)) - putchar(*s); - else - putchar('*'); - } + for (s = final; *s; s++) + carefulputc(*s, stdout, '*'); if (len < 0 || (size_t)len >= sizeof(final)) putchar('\n'); |