summaryrefslogtreecommitdiff
path: root/lib/ZLocations.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ZLocations.c')
-rw-r--r--lib/ZLocations.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/ZLocations.c b/lib/ZLocations.c
index 197d2a7..f992b72 100644
--- a/lib/ZLocations.c
+++ b/lib/ZLocations.c
@@ -106,11 +106,15 @@ Z_SendLocation(class, opcode, auth, format)
} else {
#endif /* X11 */
ttyp = ttyname(0);
- bptr[2] = rindex(ttyp, '/');
- if (bptr[2])
+ if (ttyp) {
+ bptr[2] = rindex(ttyp, '/');
+ if (bptr[2])
bptr[2]++;
- else
+ else
bptr[2] = ttyp;
+ }
+ else
+ bptr[2] = "unknown";
(void) strcpy(mytty, bptr[2]);
#ifdef X11
}