Check -n argument for validity, fix memory errors, fix over-indentation
This commit is contained in:
parent
17b8f90393
commit
e06544fab7
26
ltrace-0.6.0-dash-n.patch
Normal file
26
ltrace-0.6.0-dash-n.patch
Normal file
@ -0,0 +1,26 @@
|
||||
diff --git a/options.c b/options.c
|
||||
index d5edc1a..8dce7f8 100644
|
||||
--- a/options.c
|
||||
+++ b/options.c
|
||||
@@ -494,9 +494,19 @@ process_options(int argc, char **argv)
|
||||
case 'L':
|
||||
options.libcalls = 0;
|
||||
break;
|
||||
- case 'n':
|
||||
- options.indent = atoi(optarg);
|
||||
+ case 'n': {
|
||||
+ char *endptr;
|
||||
+ long int l = strtol(optarg, &endptr, 0);
|
||||
+ /* Arbitrary cut-off. Nobody needs to indent
|
||||
+ * more than, say, 8, anyway. */
|
||||
+ if (l < 0 || l > 20 || *optarg == 0 || *endptr != 0) {
|
||||
+ fprintf(stderr, "Invalid argument to -n: '%s'."
|
||||
+ " Use integer 0..20.\n", optarg);
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ options.indent = (int)l;
|
||||
break;
|
||||
+ }
|
||||
case 'o':
|
||||
options.output = fopen(optarg, "w");
|
||||
if (!options.output) {
|
||||
39
ltrace-0.6.0-libs-fixes-1.patch
Normal file
39
ltrace-0.6.0-libs-fixes-1.patch
Normal file
@ -0,0 +1,39 @@
|
||||
diff --git a/output.c b/output.c
|
||||
index ac8c9d0..db6e93e 100644
|
||||
--- a/output.c
|
||||
+++ b/output.c
|
||||
@@ -22,9 +22,10 @@ static int current_depth = 0;
|
||||
static int current_column = 0;
|
||||
|
||||
static void
|
||||
-output_indent(Process *proc) {
|
||||
- current_column +=
|
||||
- fprintf(options.output, "%*s", options.indent * proc->callstack_depth, "");
|
||||
+output_indent(struct Process *proc)
|
||||
+{
|
||||
+ int d = options.indent * (proc->callstack_depth - 1);
|
||||
+ current_column += fprintf(options.output, "%*s", d, "");
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/proc.c b/proc.c
|
||||
index 51833fe..54afbe0 100644
|
||||
--- a/proc.c
|
||||
+++ b/proc.c
|
||||
@@ -49,6 +49,7 @@ arch_dynlink_done(struct Process *proc)
|
||||
#endif
|
||||
|
||||
static void add_process(struct Process *proc, int was_exec);
|
||||
+static void unlist_process(struct Process *proc);
|
||||
|
||||
static int
|
||||
process_bare_init(struct Process *proc, const char *filename,
|
||||
@@ -96,7 +97,7 @@ process_bare_destroy(struct Process *proc, int was_exec)
|
||||
dict_clear(proc->breakpoints);
|
||||
if (!was_exec) {
|
||||
free(proc->filename);
|
||||
- remove_process(proc);
|
||||
+ unlist_process(proc);
|
||||
}
|
||||
}
|
||||
|
||||
13
ltrace.spec
13
ltrace.spec
@ -1,7 +1,7 @@
|
||||
Summary: Tracks runtime library calls from dynamically linked executables
|
||||
Name: ltrace
|
||||
Version: 0.6.0
|
||||
Release: 12%{?dist}
|
||||
Release: 13%{?dist}
|
||||
URL: http://ltrace.alioth.debian.org/
|
||||
License: GPLv2+
|
||||
Group: Development/Debuggers
|
||||
@ -31,6 +31,8 @@ Patch15: ltrace-0.6.0-detach-sleeping.patch
|
||||
Patch16: ltrace-0.6.0-tail-return.patch
|
||||
Patch17: ltrace-0.6.0-ppc-lwarx.patch
|
||||
Patch18: ltrace-0.6.0-libs.patch
|
||||
Patch19: ltrace-0.6.0-libs-fixes-1.patch
|
||||
Patch20: ltrace-0.6.0-dash-n.patch
|
||||
|
||||
%description
|
||||
Ltrace is a debugging program which runs a specified command until the
|
||||
@ -60,6 +62,8 @@ execution of processes.
|
||||
%patch16 -p1
|
||||
%patch17 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
%patch20 -p1
|
||||
sed -i -e 's/-o root -g root//' Makefile.in
|
||||
|
||||
%build
|
||||
@ -88,6 +92,13 @@ echo ====================TESTING END=====================
|
||||
%config(noreplace) %{_sysconfdir}/ltrace.conf
|
||||
|
||||
%changelog
|
||||
* Thu May 3 2012 Petr Machata <pmachata@redhat.com> - 0.6.0-13
|
||||
- Check -n argument for validity (ltrace-0.6.0-dash-n.patch)
|
||||
- Resolves: #818529
|
||||
- ltrace-0.6.0-libs-fixes-1.patch
|
||||
- Fix double free when process initialization fails for some reason
|
||||
- Don't indent first level of calls
|
||||
|
||||
* Mon Apr 30 2012 Petr Machata <pmachata@redhat.com> - 0.6.0-12
|
||||
- Fix 32-bit builds
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user