diff options
| author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-16 14:44:40 +0200 |
|---|---|---|
| committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-16 14:44:40 +0200 |
| commit | d1cee441d3f71f0bc0032642c7b424b870edec18 (patch) | |
| tree | c88caf634eef3cab9469dbefe12e04515982f000 /lib/plugins | |
| parent | 56014917cb69f4c8f82d80f191862cb64ed15172 (diff) | |
| download | abrt-d1cee441d3f71f0bc0032642c7b424b870edec18.tar.gz abrt-d1cee441d3f71f0bc0032642c7b424b870edec18.tar.xz abrt-d1cee441d3f71f0bc0032642c7b424b870edec18.zip | |
CCpp: better handling of uid and exit condition on bt generation
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'lib/plugins')
| -rw-r--r-- | lib/plugins/CCpp.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/plugins/CCpp.cpp b/lib/plugins/CCpp.cpp index 6d11c4dc..0fad8f44 100644 --- a/lib/plugins/CCpp.cpp +++ b/lib/plugins/CCpp.cpp @@ -161,7 +161,9 @@ static char *get_backtrace(const char *pDebugDumpDir, const char *pDebugInfoDirs return NULL; } - char *uid = dd_load_text(dd, CD_UID); + char *uid_str = dd_load_text(dd, CD_UID); + uid_t uid = xatoi_u(uid_str); + free(uid_str); char *executable = dd_load_text(dd, FILENAME_EXECUTABLE); dd_close(dd); @@ -176,7 +178,7 @@ static char *get_backtrace(const char *pDebugDumpDir, const char *pDebugInfoDirs args[0] = (char*)"gdb"; args[1] = (char*)"-batch"; - // when/if gdb supports it: + // when/if gdb supports "set debug-file-directory DIR1:DIR2": // (https://bugzilla.redhat.com/show_bug.cgi?id=528668): args[2] = (char*)"-ex"; string dfd = "set debug-file-directory /usr/lib/debug"; @@ -244,9 +246,9 @@ static char *get_backtrace(const char *pDebugDumpDir, const char *pDebugInfoDirs while (1) { args[9] = xasprintf("%s backtrace %u%s", thread_apply_all, bt_depth, full); - bt = exec_vp(args, xatoi_u(uid), /*redirect_stderr:*/ 1, timeout_sec, NULL); + bt = exec_vp(args, uid, /*redirect_stderr:*/ 1, timeout_sec, NULL); free(args[9]); - if (bt && (bt_depth <= 64 || strlen(bt) < 256*1024)) + if ((bt && strnlen(bt, 256*1024) < 256*1024) || bt_depth <= 32) { break; } @@ -266,7 +268,6 @@ static char *get_backtrace(const char *pDebugDumpDir, const char *pDebugInfoDirs full = ""; } } - free(uid); free(args[5]); free(args[7]); return bt; |
