• M
    ui/keymaps: Fix handling of erroneous include files · f7b9e299
    Markus Armbruster 提交于
    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: NMarkus Armbruster <armbru@redhat.com>
    Message-Id: <20181017082702.5581-26-armbru@redhat.com>
    Reviewed-by: NGerd Hoffmann <kraxel@redhat.com>
    f7b9e299
keymaps.c 7.3 KB