diff options
-rw-r--r-- | lib/ZLocations.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ZLocations.c b/lib/ZLocations.c index c4eaa48..4dac959 100644 --- a/lib/ZLocations.c +++ b/lib/ZLocations.c @@ -47,8 +47,8 @@ Code_t ZInitLocationInfo(hostname, tty) strcpy(mytty, tty); } else { ttyp = ttyname(0); - if (ttyp) { - p = strrchr(ttyp, '/'); + if (ttyp && *ttyp) { + p = strchr(ttyp + 1, '/'); strcpy(mytty, (p) ? p + 1 : ttyp); } else { strcpy(mytty, "unknown"); |