aboutsummaryrefslogtreecommitdiff
path: root/termo.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-10-30 23:58:29 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2015-10-31 00:00:30 +0100
commitef29b7587d536bf8a9c68c0ecbe5e45cd5a3bec3 (patch)
tree623db7a6453e07d073f776ef37545430e131c823 /termo.c
parent2a351b150dbe133037afffef01375c39aacd9d74 (diff)
downloadtermo-ef29b7587d536bf8a9c68c0ecbe5e45cd5a3bec3.tar.gz
termo-ef29b7587d536bf8a9c68c0ecbe5e45cd5a3bec3.tar.xz
termo-ef29b7587d536bf8a9c68c0ecbe5e45cd5a3bec3.zip
Fix error handling in termo_strfkey()
If in any case snprintf() returned a negative value, we would mishandle it.
Diffstat (limited to 'termo.c')
-rw-r--r--termo.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/termo.c b/termo.c
index 704116b..38caba2 100644
--- a/termo.c
+++ b/termo.c
@@ -1444,7 +1444,7 @@ termo_strfkey (termo_t *tk, char *buffer, size_t len,
termo_key_t *key, termo_format_t format)
{
size_t pos = 0;
- size_t l = 0;
+ int l = 0;
struct modnames *mods = &modnames[
!!(format & TERMO_FORMAT_LONGMOD) +
@@ -1477,7 +1477,7 @@ termo_strfkey (termo_t *tk, char *buffer, size_t len,
{
l = snprintf (buffer + pos, len - pos,
wrapbracket ? "<^%c>" : "^%c", (char) codepoint);
- if(l <= 0)
+ if (l <= 0)
return pos;
pos += l;
return pos;