pxe: Don't leak inode on timeout
[syslinux.git] / com32 / modules / kbdmap.c
blob7ec40018c91b6bee513f38313721342ec9ad2577
1 /* ----------------------------------------------------------------------- *
3 * Copyright 2009 Intel Corporation; author: H. Peter Anvin
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
8 * Boston MA 02110-1301, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
11 * ----------------------------------------------------------------------- */
13 #include <stdio.h>
14 #include <string.h>
15 #include <console.h>
16 #include <syslinux/loadfile.h>
17 #include <syslinux/keyboard.h>
19 static inline void error(const char *msg)
21 fputs(msg, stderr);
24 int main(int argc, char *argv[])
26 const struct syslinux_keyboard_map *const kmap = syslinux_keyboard_map();
27 size_t map_size;
28 void *kbdmap;
30 if (argc != 2) {
31 error("Usage: kbdmap mapfile\n");
32 return 1;
35 if (kmap->version != 1) {
36 error("Syslinux core version mismatch\n");
37 return 1;
40 if (loadfile(argv[1], &kbdmap, &map_size)) {
41 error("Keyboard map file load error\n");
42 return 1;
45 if (map_size != kmap->length) {
46 error("Keyboard map file format error\n");
47 return 1;
50 memcpy(kmap->map, kbdmap, map_size);
51 return 0;