return 0 not null string when user has a ctty but no utmp entry
authorJay Lepreau <lepreau@ucbvax.Berkeley.EDU>
Sat, 10 May 1986 07:14:11 +0000 (23:14 -0800)
committerJay Lepreau <lepreau@ucbvax.Berkeley.EDU>
Sat, 10 May 1986 07:14:11 +0000 (23:14 -0800)
SCCS-vsn: lib/libc/gen/getlogin.c 5.3

usr/src/lib/libc/gen/getlogin.c

index 4ce32ef..6159806 100644 (file)
@@ -23,6 +23,8 @@ getlogin()
                return (0);
        }
        close(uf);
                return (0);
        }
        close(uf);
+       if (ubuf.ut_name[0] == '\0')
+               return (0);
        ubuf.ut_name[sizeof (ubuf.ut_name)] = ' ';
        for (cp = ubuf.ut_name; *cp++ != ' '; )
                ;
        ubuf.ut_name[sizeof (ubuf.ut_name)] = ' ';
        for (cp = ubuf.ut_name; *cp++ != ' '; )
                ;