summaryrefslogtreecommitdiff
path: root/lib/ZLocations.c
diff options
context:
space:
mode:
authorGravatar Kenneth G Raeburn <raeburn@mit.edu>1990-10-19 02:58:51 +0000
committerGravatar Kenneth G Raeburn <raeburn@mit.edu>1990-10-19 02:58:51 +0000
commit82a5d98d1cdebab08e9d9953489e69432a6ba556 (patch)
tree2881feab63bfd5f3b718211181693b4a513eba8b /lib/ZLocations.c
parentca7996d028d02be05595c87f19ef7baea8fb8fc8 (diff)
If ttyname returns null, use "unknown".
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
}