From 41f9f03d96c5e80d400d7885dab13cc55d20259d Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 09 2020 21:38:05 +0000 Subject: Apply patch ltrace-0.7.91-cant_open.patch patch_name: ltrace-0.7.91-cant_open.patch present_in_specfile: true --- diff --git a/libltrace.c b/libltrace.c index 8a7e1b8..8ce9ac6 100644 --- a/libltrace.c +++ b/libltrace.c @@ -113,9 +113,13 @@ ltrace_init(int argc, char **argv) { if (command) { /* Check that the binary ABI is supported before * calling execute_program. */ - struct ltelf lte; - ltelf_init(<e, command); - ltelf_destroy(<e); + { + struct ltelf lte; + if (ltelf_init(<e, command) == 0) + ltelf_destroy(<e); + else + exit(EXIT_FAILURE); + } pid_t pid = execute_program(command, argv); struct process *proc = open_program(command, pid); diff --git a/ltrace-elf.c b/ltrace-elf.c index 6f86d56..8997518 100644 --- a/ltrace-elf.c +++ b/ltrace-elf.c @@ -361,8 +361,11 @@ ltelf_init(struct ltelf *lte, const char *filename) { memset(lte, 0, sizeof *lte); lte->fd = open(filename, O_RDONLY); - if (lte->fd == -1) + if (lte->fd == -1) { + fprintf(stderr, "Can't open %s: %s\n", filename, + strerror(errno)); return 1; + } elf_version(EV_CURRENT);