diff options
author | 2015-10-26 22:03:04 +0000 | |
---|---|---|
committer | 2015-10-26 22:03:04 +0000 | |
commit | aa60fd48f9c224fe43fa9d6fd7d5e3ce80f807b4 (patch) | |
tree | 59bbf9d2d15c9c58e8dce4bcc09b3de4cb007be7 /usr.bin/tmux/key-string.c | |
parent | remove the profiling and debugging ifdefs; ok zhuk@ (diff) | |
download | wireguard-openbsd-aa60fd48f9c224fe43fa9d6fd7d5e3ce80f807b4.tar.xz wireguard-openbsd-aa60fd48f9c224fe43fa9d6fd7d5e3ce80f807b4.zip |
Handle unknown keys more gracefully, return a string instead of NULL.
Diffstat (limited to 'usr.bin/tmux/key-string.c')
-rw-r--r-- | usr.bin/tmux/key-string.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/tmux/key-string.c b/usr.bin/tmux/key-string.c index b8e68b298de..80f7396c018 100644 --- a/usr.bin/tmux/key-string.c +++ b/usr.bin/tmux/key-string.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key-string.c,v 1.26 2015/04/19 21:34:21 nicm Exp $ */ +/* $OpenBSD: key-string.c,v 1.27 2015/10/26 22:03:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -238,8 +238,10 @@ key_string_lookup_key(int key) } /* Invalid keys are errors. */ - if (key == 127 || key > 255) - return (NULL); + if (key == 127 || key > 255) { + snprintf(out, sizeof out, "<INVALID#%04x>", key); + return (out); + } /* Check for standard or control key. */ if (key >= 0 && key <= 32) { |