fixed a core dump due to incorrect if construct

This commit is contained in:
Todd C. Miller
1995-08-14 03:34:36 +00:00
parent f1bd62ffb7
commit bf3ef98bae

View File

@@ -136,9 +136,8 @@ void log_error(code)
* Get our ttyname or set to "none"
*/
tty = (char *) ttyname(0);
if (tty)
if ((p = strrchr(tty, '/')))
tty = p + 1;
if (tty && (p = strrchr(tty, '/')))
tty = p + 1;
else
tty = "none";