diff options
author | Karel Klic <kklic@redhat.com> | 2009-11-19 10:14:27 +0100 |
---|---|---|
committer | Karel Klic <kklic@redhat.com> | 2009-11-19 10:14:27 +0100 |
commit | bd60681c8227bc31ef0991e98a9a3e849032c924 (patch) | |
tree | 5d4f3cf03d54ecb30ab863c7cc349bfcd232346c /src/Hooks | |
parent | 0ecc573a8ba79bca8e37809c41f92f0b629149e8 (diff) | |
parent | 83aea71df4761ec10c0d947055e65102bcace489 (diff) | |
download | abrt-bd60681c8227bc31ef0991e98a9a3e849032c924.tar.gz abrt-bd60681c8227bc31ef0991e98a9a3e849032c924.tar.xz abrt-bd60681c8227bc31ef0991e98a9a3e849032c924.zip |
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'src/Hooks')
-rw-r--r-- | src/Hooks/CCpp.cpp | 14 | ||||
-rw-r--r-- | src/Hooks/abrt_exception_handler.py.in | 18 | ||||
-rw-r--r-- | src/Hooks/sitecustomize.py | 4 |
3 files changed, 16 insertions, 20 deletions
diff --git a/src/Hooks/CCpp.cpp b/src/Hooks/CCpp.cpp index 3ab8f406..2b753819 100644 --- a/src/Hooks/CCpp.cpp +++ b/src/Hooks/CCpp.cpp @@ -65,7 +65,7 @@ static char* get_cmdline(pid_t pid) if (len > 0) { /* In Linux, there is always one trailing NUL byte, - * prevent it from being replaced by space below. + * prevent it from being replaced by space below. */ if (cmdline[len - 1] == '\0') len--; @@ -164,22 +164,20 @@ int main(int argc, char** argv) try { - char* executable; - char* cmdline; - executable = get_executable(pid); - cmdline = get_cmdline(pid); - if (executable == NULL || cmdline == NULL) + char* executable = get_executable(pid); + if (executable == NULL) { - error_msg_and_die("can not get proc info for pid %u", (int)pid); + error_msg_and_die("can't read /proc/%u/exe link", (int)pid); } if (strstr(executable, "/abrt")) { /* free(executable); - why bother? */ - /* free(cmdline); */ error_msg_and_die("pid %u is '%s', not dumping it to avoid abrt recursion", (int)pid, executable); } + char* cmdline = get_cmdline(pid); /* never NULL */ + char path[PATH_MAX]; snprintf(path, sizeof(path), "%s/ccpp-%ld-%u", dddir, (long)time(NULL), (int)pid); diff --git a/src/Hooks/abrt_exception_handler.py.in b/src/Hooks/abrt_exception_handler.py.in index 5514f1a4..c7f72530 100644 --- a/src/Hooks/abrt_exception_handler.py.in +++ b/src/Hooks/abrt_exception_handler.py.in @@ -46,8 +46,6 @@ import sys import os import syslog import subprocess -# abrt lib for saving debugdumps -import ABRTUtils __DUMPHASH = {} # FIXME: do length limits on obj dumps. @@ -108,7 +106,7 @@ def write_dump(pid, tb_uuid, tb): executable = "Exception raised from python shell" if sys.argv[0]: executable = os.path.abspath(sys.argv[0]) - + command = ["abrt-pyhook-helper"] command.append("--pid=%s" % pid) command.append("--executable=%s" % executable) @@ -180,12 +178,12 @@ def handleMyException((etype, value, tb)): # ignore uncaught ctrl-c if etype == KeyboardInterrupt: return sys.__excepthook__(etype, value, tb) - + try: import os.path from hashlib import md5 import traceback - + syslog.syslog("abrt: Pyhook: Detected unhandled exception in %s " % sys.argv[0]) elist = traceback.format_exception (etype, value, tb) tblast = traceback.extract_tb(tb, limit=None) @@ -199,20 +197,20 @@ def handleMyException((etype, value, tb)): ll.extend(tblast[:3]) ll[0] = os.path.basename(tblast[0]) tblast = ll - + m = md5() ntext = "" for t in tblast: ntext += str(t) + ":" m.update(str(t)) - + tb_uuid = str(m.hexdigest())[:8] text += tb_uuid + " " + ntext - + text += extxt[0] text += "\n" text += "".join(elist) - + trace = tb while trace.tb_next: trace = trace.tb_next @@ -223,7 +221,7 @@ def handleMyException((etype, value, tb)): text += "%s: %s\n" % (key, val) except: pass - + # add coredump saving write_dump(os.getpid(), tb_uuid, text) except: #silently ignore any error in this hook, to not interfere with the python scripts diff --git a/src/Hooks/sitecustomize.py b/src/Hooks/sitecustomize.py index 32a3747b..5787c03f 100644 --- a/src/Hooks/sitecustomize.py +++ b/src/Hooks/sitecustomize.py @@ -22,13 +22,13 @@ try: line = config.readline().lower().replace(' ','').strip('\n').split('=') conf[line[0]] = line[1] except: - # Ignore silently everything, because we don't want to bother user + # Ignore silently everything, because we don't want to bother user # if this hook doesn't work. pass if conf.has_key("enabled"): # Prevent abrt exception handler from running when the abrtd daemon is - # not active. + # not active. # abrtd sets the value to "no" when deactivated and vice versa. if conf["enabled"] == "yes": try: |