Ignore tilde in ut_line

This commit is contained in:
sin 2013-08-05 16:12:01 +01:00 committed by David Galos
parent 918269e057
commit eddb6d39a5

3
who.c
View File

@ -33,7 +33,8 @@ main(int argc, char **argv)
eprintf("fopen:"); eprintf("fopen:");
} }
while(fread(&usr, sizeof(usr), 1, ufp) == 1) { while(fread(&usr, sizeof(usr), 1, ufp) == 1) {
if (!*usr.ut_name || !*usr.ut_line) if (!*usr.ut_name || !*usr.ut_line ||
usr.ut_line[0] == '~')
continue; continue;
if (mflag && strcmp(usr.ut_line, if (mflag && strcmp(usr.ut_line,
strrchr(ttyname(STDIN_FILENO), '/') + 1)) strrchr(ttyname(STDIN_FILENO), '/') + 1))