summaryrefslogtreecommitdiffstats
path: root/src/Hooks/CCpp.cpp
diff options
context:
space:
mode:
authorKarel Klic <kklic@redhat.com>2009-11-19 10:14:27 +0100
committerKarel Klic <kklic@redhat.com>2009-11-19 10:14:27 +0100
commitbd60681c8227bc31ef0991e98a9a3e849032c924 (patch)
tree5d4f3cf03d54ecb30ab863c7cc349bfcd232346c /src/Hooks/CCpp.cpp
parent0ecc573a8ba79bca8e37809c41f92f0b629149e8 (diff)
parent83aea71df4761ec10c0d947055e65102bcace489 (diff)
downloadabrt-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/CCpp.cpp')
-rw-r--r--src/Hooks/CCpp.cpp14
1 files changed, 6 insertions, 8 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);