diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-04 21:21:14 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-04 21:21:14 +0100 |
| commit | d45b0c1cfe5fdd9648d880a059b13c4fbee4c8ee (patch) | |
| tree | 8ff325a68a6007e4f3abea262f1bd27d56793ce2 /src/Hooks/abrt-hook-python.cpp | |
| parent | f9d98f594a2b5103f0e88bf33191ad164a77c239 (diff) | |
| parent | 75c6e1fc1113984b30a4d84c1cfe6e97c70c398f (diff) | |
Merge branch 'master' into rhel6
Diffstat (limited to 'src/Hooks/abrt-hook-python.cpp')
| -rw-r--r-- | src/Hooks/abrt-hook-python.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Hooks/abrt-hook-python.cpp b/src/Hooks/abrt-hook-python.cpp index 90197cc..5686c17 100644 --- a/src/Hooks/abrt-hook-python.cpp +++ b/src/Hooks/abrt-hook-python.cpp @@ -139,8 +139,10 @@ int main(int argc, char** argv) // Create directory with the debug dump char path[PATH_MAX]; - snprintf(path, sizeof(path), DEBUG_DUMPS_DIR"/pyhook-%ld-%s", + unsigned path_len = snprintf(path, sizeof(path), DEBUG_DUMPS_DIR"/pyhook-%ld-%s.new", (long)time(NULL), pid); + if (path_len >= sizeof(path)) + exit(1); CDebugDump dd; try { dd.Create(path, getuid()); @@ -160,6 +162,12 @@ int main(int argc, char** argv) dd.SaveText(FILENAME_UID, uid); dd.Close(); + + char *newpath = xstrndup(path, path_len - (sizeof(".new")-1)); + if (rename(path, newpath) != 0) + strcpy(path, newpath); + free(newpath); + log("saved python crash dump of pid %s to %s", pid, path); if (setting_MaxCrashReportsSize > 0) |
