diff options
author | Sean Young <sean@mess.org> | 2018-08-17 16:51:12 +0100 |
---|---|---|
committer | Sean Young <sean@mess.org> | 2018-08-17 16:51:12 +0100 |
commit | 87e1d5afbda2ef76920ff6e806e2a03053637382 (patch) | |
tree | 77e926e966d8378b683c400e51b7dabe892b5fa4 /utils | |
parent | 0c0372f8f5fb96074d61f34c3585d72f08476b5f (diff) |
keytable: fix build without libelf
Signed-off-by: Sean Young <sean@mess.org>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/keytable/keytable.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 9cec8694..a7ed436b 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -1980,7 +1980,7 @@ static void clear_bpf(const char *lirc_name) fprintf(stderr, _("BPF protocols removed\n")); } #else -static void attach_bpf(const char *lirc_name, const char *bpf_prog) +static void attach_bpf(const char *lirc_name, const char *bpf_prog, struct toml_table_t *toml) { fprintf(stderr, _("error: ir-keytable was compiled without BPF support\n")); } @@ -2041,10 +2041,17 @@ static char *find_bpf_file(const char *name) if (!stat(name, &st)) return strdup(name); - asprintf(&fname, IR_PROTOCOLS_USER_DIR "/%s.o", name); + if (asprintf(&fname, IR_PROTOCOLS_USER_DIR "/%s.o", name) < 0) { + fprintf(stderr, _("asprintf failed: %m\n")); + return NULL; + } + if (stat(fname, &st)) { free(fname); - asprintf(&fname, IR_PROTOCOLS_SYSTEM_DIR "/%s.o", name); + if (asprintf(&fname, IR_PROTOCOLS_SYSTEM_DIR "/%s.o", name) < 0) { + fprintf(stderr, _("asprintf failed: %m\n")); + return NULL; + } if (stat(fname, &st)) { fprintf(stderr, _("Can't find %s bpf protocol in %s or %s\n"), name, IR_KEYTABLE_USER_DIR "/protocols", IR_KEYTABLE_SYSTEM_DIR "/protocols"); |