ishcherb / rpms / abrt

Forked from rpms/abrt 6 years ago
Clone
fa19501
From de3b8b654d4962e1fa2d7b068644beeed7b0826d Mon Sep 17 00:00:00 2001
fa19501
From: Jakub Filak <jfilak@redhat.com>
fa19501
Date: Tue, 21 Apr 2015 07:54:17 +0200
fa19501
Subject: [PATCH] ccpp: avoid overriding system files by coredump
fa19501
fa19501
Related: #1211835
fa19501
fa19501
Signed-off-by: Jakub Filak <jfilak@redhat.com>
fa19501
---
fa19501
 src/hooks/abrt-hook-ccpp.c | 2 +-
fa19501
 1 file changed, 1 insertion(+), 1 deletion(-)
fa19501
fa19501
diff --git a/src/hooks/abrt-hook-ccpp.c b/src/hooks/abrt-hook-ccpp.c
fa19501
index 9696423..c4ad8d1 100644
fa19501
--- a/src/hooks/abrt-hook-ccpp.c
fa19501
+++ b/src/hooks/abrt-hook-ccpp.c
fa19501
@@ -373,7 +373,7 @@ user_core_fail:
fa19501
 /* Like xopen, but on error, unlocks and deletes dd and user core */
fa19501
 static int create_or_die(const char *filename, int user_core_fd)
fa19501
 {
fa19501
-    int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, DEFAULT_DUMP_DIR_MODE);
fa19501
+    int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, DEFAULT_DUMP_DIR_MODE);
fa19501
     if (fd >= 0)
fa19501
     {
fa19501
         IGNORE_RESULT(fchown(fd, dd->dd_uid, dd->dd_gid));
fa19501
-- 
fa19501
2.1.0
fa19501