Fix a problem in handling a failure to open an ELF file
This commit is contained in:
parent
3eda79ec21
commit
c1bce5fd6b
36
ltrace-0.7.91-cant_open.patch
Normal file
36
ltrace-0.7.91-cant_open.patch
Normal file
@ -0,0 +1,36 @@
|
||||
diff -urp ltrace-0.7.91/libltrace.c master/libltrace.c
|
||||
--- ltrace-0.7.91/libltrace.c 2014-01-14 16:31:37.696174464 +0100
|
||||
+++ master/libltrace.c 2013-11-21 14:06:38.623701688 +0100
|
||||
@@ -113,9 +117,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 -urp ltrace-0.7.91/ltrace-elf.c master/ltrace-elf.c
|
||||
--- ltrace-0.7.91/ltrace-elf.c 2014-01-14 16:31:37.688174420 +0100
|
||||
+++ master/ltrace-elf.c 2013-11-22 18:17:11.767721609 +0100
|
||||
@@ -361,8 +361,11 @@ ltelf_init(struct ltelf *lte, const char
|
||||
{
|
||||
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);
|
||||
|
||||
10
ltrace.spec
10
ltrace.spec
@ -1,7 +1,7 @@
|
||||
Summary: Tracks runtime library calls from dynamically linked executables
|
||||
Name: ltrace
|
||||
Version: 0.7.91
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
URL: http://ltrace.alioth.debian.org/
|
||||
License: GPLv2+
|
||||
Group: Development/Debuggers
|
||||
@ -43,6 +43,9 @@ Patch7: ltrace-0.7.91-ppc64-unprelink.patch
|
||||
# Man page nits. Backport of an upstream patch.
|
||||
Patch8: ltrace-0.7.91-man.patch
|
||||
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1044766
|
||||
Patch9: ltrace-0.7.91-cant_open.patch
|
||||
|
||||
%description
|
||||
Ltrace is a debugging program which runs a specified command until the
|
||||
command exits. While the command is executing, ltrace intercepts and
|
||||
@ -64,6 +67,7 @@ execution of processes.
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
|
||||
%build
|
||||
%configure --docdir=%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}}
|
||||
@ -88,6 +92,10 @@ echo ====================TESTING END=====================
|
||||
%{_datadir}/ltrace
|
||||
|
||||
%changelog
|
||||
* Tue Jan 14 2014 Petr Machata <pmachata@redhat.com> - 0.7.91-6
|
||||
- Fix a problem when an invalid command has been found
|
||||
(ltrace-0.7.91-cant_open.patch)
|
||||
|
||||
* Tue Jan 14 2014 Petr Machata <pmachata@redhat.com> - 0.7.91-5
|
||||
- Fix interpretation of x86_64 PLT with IRELATIVE slots.
|
||||
(ltrace-0.7.91-x86_64-irelative.patch)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user