db-move: moved adwaita-icon-theme from [testing] to [extra] (any)
[arch-packages.git] / kbd / trunk / kbd-fix-loadkmap-compat.patch
blobd7143501ac085223909f6c3ea2c51e54b8571b8b
1 diff --git a/src/libkeymap/dump.c b/src/libkeymap/dump.c
2 index 83ac351..8531b5a 100644
3 --- a/src/libkeymap/dump.c
4 +++ b/src/libkeymap/dump.c
5 @@ -72,9 +72,14 @@ int lk_dump_bkeymap(struct lk_ctx *ctx, FILE *fd)
6 continue;
8 for (j = 0; j < NR_KEYS / 2; j++) {
9 - int v = lk_get_key(ctx, i, j);
10 + int value = lk_get_key(ctx, i, j);
12 - if (fwrite(&v, sizeof(v), 1, fd) != 1)
13 + if (value < 0 || value > USHRT_MAX) {
14 + ERR(ctx, _("can not bind key %d to value %d because it is too large"), j, value);
15 + goto fail;
16 + }
18 + if (fwrite(&value, sizeof(unsigned short), 1, fd) != 1)
19 goto fail;