summaryrefslogtreecommitdiffstats
path: root/src/Hooks
diff options
context:
space:
mode:
authorKarel Klic <kklic@redhat.com>2009-11-12 16:58:07 +0100
committerKarel Klic <kklic@redhat.com>2009-11-12 16:58:07 +0100
commit32cee84a34c005fe0d2863f439007ec633687fa8 (patch)
tree149ca7014e4295de3788f28ae88e9d9d7003da46 /src/Hooks
parent5a8a8a6c99c9067e0dfcce839c32826a2badff0b (diff)
parent3938e6e075867ae3a349ba307ee672aa458d2662 (diff)
downloadabrt-32cee84a34c005fe0d2863f439007ec633687fa8.tar.gz
abrt-32cee84a34c005fe0d2863f439007ec633687fa8.tar.xz
abrt-32cee84a34c005fe0d2863f439007ec633687fa8.zip
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'src/Hooks')
-rw-r--r--src/Hooks/CCpp.cpp10
-rw-r--r--src/Hooks/Makefile.am4
-rw-r--r--src/Hooks/abrt-pyhook-helper.cpp14
-rw-r--r--src/Hooks/abrt_exception_handler.py.in1
4 files changed, 11 insertions, 18 deletions
diff --git a/src/Hooks/CCpp.cpp b/src/Hooks/CCpp.cpp
index 0f95d05..3ab8f40 100644
--- a/src/Hooks/CCpp.cpp
+++ b/src/Hooks/CCpp.cpp
@@ -205,19 +205,19 @@ int main(int argc, char** argv)
dd.Close();
perror_msg_and_die("can't open '%s'", path);
}
- if (copyfd_eof(STDIN_FILENO, fd) < 0)
+ off_t size = copyfd_eof(STDIN_FILENO, fd);
+ if (size < 0 || close(fd) != 0)
{
- /* close(fd); - why bother? */
+ unlink(path);
dd.Delete();
dd.Close();
/* copyfd_eof logs the error including errno string,
* but it does not log file name */
error_msg_and_die("error saving coredump to %s", path);
}
- /* close(fd); - why bother? */
- /* free(executable); */
+ /* free(executable); - why bother? */
/* free(cmdline); */
- log("saved core dump of pid %u to %s", (int)pid, path);
+ log("saved core dump of pid %u to %s (%llu bytes)", (int)pid, path, (long long)size);
}
catch (CABRTException& e)
{
diff --git a/src/Hooks/Makefile.am b/src/Hooks/Makefile.am
index 4eb25e2..e581c25 100644
--- a/src/Hooks/Makefile.am
+++ b/src/Hooks/Makefile.am
@@ -57,7 +57,3 @@ abrt_exception_handler.py:
# RPM fix: we need to regenerate abrt_exception_handler.py, because it has the default ddir
install-data-local:
sed s,@DEBUG_DUMP_DIR@,$(DEBUG_DUMPS_DIR),g abrt_exception_handler.py.in > abrt_exception_handler.py
-
-install-data-hook:
- chmod u+s,g+s $(DESTDIR)$(bindir)/abrt-pyhook-helper
-
diff --git a/src/Hooks/abrt-pyhook-helper.cpp b/src/Hooks/abrt-pyhook-helper.cpp
index 8a5a191..08ccc12 100644
--- a/src/Hooks/abrt-pyhook-helper.cpp
+++ b/src/Hooks/abrt-pyhook-helper.cpp
@@ -20,6 +20,7 @@
*/
#include <getopt.h>
+#include <unistd.h>
/* We can easily get rid of abrtlib (libABRTUtils.so) usage in this file,
* but DebugDump will pull it in anyway */
#include "abrtlib.h"
@@ -34,7 +35,6 @@ static char *pid;
static char *executable;
static char *uuid;
static char *cmdline;
-static char *loginuid;
int main(int argc, char** argv)
{
@@ -45,7 +45,6 @@ int main(int argc, char** argv)
{ "executable", required_argument, NULL, 'e' },
{ "uuid" , required_argument, NULL, 'u' },
{ "cmdline" , required_argument, NULL, 'c' },
- { "loginuid" , required_argument, NULL, 'l' },
{ 0 },
};
int opt;
@@ -65,9 +64,6 @@ int main(int argc, char** argv)
case 'c':
cmdline = optarg;
break;
- case 'l':
- loginuid = optarg;
- break;
default:
usage:
error_msg_and_die(
@@ -77,7 +73,6 @@ int main(int argc, char** argv)
" -p,--executable PATH absolute path to the program that crashed\n"
" -u,--uuid UUID hash generated from the backtrace\n"
" -c,--cmdline TEXT command line of the crashed program\n"
- " -l,--loginuid UID login UID\n"
);
}
}
@@ -112,8 +107,11 @@ int main(int argc, char** argv)
dd.SaveText("cmdline", cmdline);
if (uuid)
dd.SaveText("uuid", uuid);
- if (loginuid)
- dd.SaveText("uid", loginuid);
+
+ char uid[sizeof(int) * 3 + 2];
+ sprintf(uid, "%d", (int)getuid());
+ dd.SaveText("uid", uid);
+
dd.SaveText("backtrace", bt);
free(bt);
dd.Close();
diff --git a/src/Hooks/abrt_exception_handler.py.in b/src/Hooks/abrt_exception_handler.py.in
index 010bf12..5514f1a 100644
--- a/src/Hooks/abrt_exception_handler.py.in
+++ b/src/Hooks/abrt_exception_handler.py.in
@@ -114,7 +114,6 @@ def write_dump(pid, tb_uuid, tb):
command.append("--executable=%s" % executable)
command.append("--uuid=%s" % tb_uuid)
command.append("--cmdline=%s" % open("/proc/%s/cmdline" % pid).read().replace('\x00',' '))
- command.append("--loginuid=%s" % open("/proc/%s/loginuid" % pid).readlines()[0])
helper = subprocess.Popen(command, stdin=subprocess.PIPE)
helper.communicate(tb)