diff options
author | Sean Young <sean@mess.org> | 2019-09-07 21:40:23 +0100 |
---|---|---|
committer | Sean Young <sean@mess.org> | 2019-09-07 21:53:42 +0100 |
commit | b972d2d6cea558c6fc304938b56518281c953185 (patch) | |
tree | 2712aeefd3f69d1d072109aab560f4fad91eb56e | |
parent | f14633618f891de77243c7e5a64262f9082503bd (diff) |
ir-ctl: print error message if file cannot be opened
ir-ctl -k foo -K FOO says nothing if foo is not found.
Signed-off-by: Sean Young <sean@mess.org>
-rw-r--r-- | utils/common/keymap.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/utils/common/keymap.c b/utils/common/keymap.c index 20026cc4..12526461 100644 --- a/utils/common/keymap.c +++ b/utils/common/keymap.c @@ -88,7 +88,8 @@ static error_t parse_plain_keymap(char *fname, struct keymap **keymap, bool verb fin = fopen(fname, "r"); if (!fin) { - return errno; + fprintf(stderr, _("%s: error: cannot open: %m\n"), fname); + return EINVAL; } while (fgets(s, sizeof(s), fin)) { @@ -457,8 +458,10 @@ static error_t parse_toml_keymap(char *fname, struct keymap **keymap, bool verbo fprintf(stderr, _("Parsing %s keycode file as toml\n"), fname); fin = fopen(fname, "r"); - if (!fin) - return errno; + if (!fin) { + fprintf(stderr, _("%s: error: cannot open: %m\n"), fname); + return EINVAL; + } root = toml_parse_file(fin, buf, sizeof(buf)); fclose(fin); |