No warnings, no errors, unit tests works, looks good to me :) Pushed. Thank
you!
On Monday 22 of April 2013 12:07:13 Martin Milata wrote:
Closes rhbz#951529.
Signed-off-by: Martin Milata <mmilata(a)redhat.com>
---
lib/core-backtrace-oops.c | 8 ++++++--
lib/core-backtrace-python.c | 5 ++++-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/lib/core-backtrace-oops.c b/lib/core-backtrace-oops.c
index 47a80f6..04869ee 100644
--- a/lib/core-backtrace-oops.c
+++ b/lib/core-backtrace-oops.c
@@ -20,6 +20,7 @@
*/
#include <stdio.h>
+#include <inttypes.h>
#include "utils.h"
#include "core-backtrace-oops.h"
@@ -148,7 +149,7 @@ btp_parse_kerneloops(char *text, const char *kernelver)
struct backtrace_entry *frame = btp_mallocz(sizeof(struct
backtrace_entry));
/* address */
- if (sscanf(line, "[<%llx>]", &frame->address) != 1)
+ if (sscanf(line, "[<%" SCNx64 ">]",
&frame->address) != 1)
{
btp_backtrace_entry_free(frame);
/* not printing the error - not match means just skip line */
@@ -200,13 +201,16 @@ btp_parse_kerneloops(char *text, const char
*kernelver) ++splitter;
/* offset, function legth */
- if (sscanf(splitter, "0x%x/0x%x", &frame->build_id_offset,
&frame->function_length) != 2) + uintmax_t tmp_offset, tmp_length;
+ if (sscanf(splitter, "0x%jx/0x%jx", &tmp_offset, &tmp_length)
!= 2)
{
btp_backtrace_entry_free(frame);
fprintf(stderr, "Unable to read offset & function length:
'%s'\n", line); line = nextline;
continue;
}
+ frame->build_id_offset = (uintptr_t)tmp_offset;
+ frame->function_length = (uintptr_t)tmp_length;
/* module */
/* in the 2nd example mentioned above, [] also matches
diff --git a/lib/core-backtrace-python.c b/lib/core-backtrace-python.c
index b127ae1..9b2e9b4 100644
--- a/lib/core-backtrace-python.c
+++ b/lib/core-backtrace-python.c
@@ -135,13 +135,16 @@ btp_parse_python_backtrace(char *text)
continue;
}
offsetstr += strlen("line ");
- if (sscanf(offsetstr, "%u", &frame->build_id_offset) != 1)
+
+ uintmax_t tmp_lineno;
+ if (sscanf(offsetstr, "%ju", &tmp_lineno) != 1)
{
btp_backtrace_entry_free(frame);
fprintf(stderr, "Unable to parse line number\n");
line = nextline;
continue;
}
+ frame->build_id_offset = (uintptr_t)tmp_lineno;
/* function name */
const char *funcname = strstr(splitter, ", in ");