This repository has been archived on 2026-01-16. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
abrt-addon-python3/0103-ccpp-avoid-overriding-system-files-by-coredump.patch
Matej Habrnal 69165ba9cc Introduce abrt-addon-python3 package
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
2017-07-04 09:22:28 +02:00

28 lines
1 KiB
Diff

From cdb4c5b0855d910132e61d71afbd445b0271fcb4 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 21 Apr 2015 07:54:17 +0200
Subject: [ABRT PATCH] ccpp: avoid overriding system files by coredump
Related: #1211835
Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/hooks/abrt-hook-ccpp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/hooks/abrt-hook-ccpp.c b/src/hooks/abrt-hook-ccpp.c
index 3a6d002..02f15d5 100644
--- a/src/hooks/abrt-hook-ccpp.c
+++ b/src/hooks/abrt-hook-ccpp.c
@@ -544,7 +544,7 @@ static bool dump_fd_info(const char *dest_filename, char *source_filename, int s
/* Like xopen, but on error, unlocks and deletes dd and user core */
static int create_or_die(const char *filename)
{
- int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, DEFAULT_DUMP_DIR_MODE);
+ int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, DEFAULT_DUMP_DIR_MODE);
if (fd >= 0)
{
IGNORE_RESULT(fchown(fd, dd->dd_uid, dd->dd_gid));
--
1.8.3.1