]> git.proxmox.com Git - mirror_qemu.git/commit
ui/keymaps: Fix handling of erroneous include files
authorMarkus Armbruster <armbru@redhat.com>
Wed, 17 Oct 2018 08:26:49 +0000 (10:26 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Fri, 19 Oct 2018 12:51:34 +0000 (14:51 +0200)
commitf7b9e299a44343115148246b4de53fb3ac6e7b22
tree604e117c7ec1552dcc33b47aab5bd178d8b94b07
parentcd65f34991f01c23c9e3e1691953b79e36a1b911
ui/keymaps: Fix handling of erroneous include files

While errors in the keyboard layout named with -k are fatal, errors in
included files are reported, but otherwise ignored:

    $ cat worst
    include bad
    include worse
    $ ls -l bad worse
    ls: cannot access 'bad': No such file or directory
    ls: cannot access 'worse': No such file or directory
    $ qemu-system-x86_64 -nodefaults -S -monitor stdio -display vnc=:0 -k bad
    QEMU 3.0.50 monitor - type 'help' for more information
    (qemu) Could not read keymap file: 'bad'
    $ qemu-system-x86_64 -nodefaults -S -monitor stdio -display vnc=:0 -k worst
    QEMU 3.0.50 monitor - type 'help' for more information
    (qemu) Could not read keymap file: 'bad'
    Could not read keymap file: 'worse'

Fix that.

Note that parse_keyboard_layout() allocates the keymap, except when
it's parsing an include file.  To keep error handling simple, move the
memory management to its caller init_keyboard_layout().

Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181017082702.5581-26-armbru@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
ui/keymaps.c