aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-01-06 23:41:54 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-01-07 00:11:24 +0000
commit6461dbbcb47c6b1be786eb5c3d5a39f97f5dfb3d (patch)
tree0b38e27f12aef8735cfe5e9a4772b7d9f38efb39
parenteacc541e4b81f5f50b19fb1a32266d760f4cf783 (diff)
downloadpaludis-6461dbbcb47c6b1be786eb5c3d5a39f97f5dfb3d.tar.gz
paludis-6461dbbcb47c6b1be786eb5c3d5a39f97f5dfb3d.tar.xz
O_CLOEXEC on files
-rw-r--r--paludis/util/safe_ifstream.cc4
-rw-r--r--paludis/util/safe_ofstream.cc4
2 files changed, 4 insertions, 4 deletions
diff --git a/paludis/util/safe_ifstream.cc b/paludis/util/safe_ifstream.cc
index 50d28b5..62704ba 100644
--- a/paludis/util/safe_ifstream.cc
+++ b/paludis/util/safe_ifstream.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009 Ciaran McCreesh
+ * Copyright (c) 2009, 2010 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -100,7 +100,7 @@ namespace
{
Context context("When opening '" + stringify(e) + "' for read:");
- int result(open(stringify(e).c_str(), O_RDONLY));
+ int result(open(stringify(e).c_str(), O_RDONLY | O_CLOEXEC));
if (-1 == result)
throw SafeIFStreamError("Could not open '" + stringify(e) + "': " + strerror(errno));
diff --git a/paludis/util/safe_ofstream.cc b/paludis/util/safe_ofstream.cc
index a715924..6f1c31d 100644
--- a/paludis/util/safe_ofstream.cc
+++ b/paludis/util/safe_ofstream.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009 Ciaran McCreesh
+ * Copyright (c) 2009, 2010 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -63,7 +63,7 @@ namespace
Context context("When opening '" + stringify(e) + "' for write:");
if (-1 == open_flags)
- open_flags = O_CREAT | O_TRUNC | O_WRONLY;
+ open_flags = O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC;
int result(open(stringify(e).c_str(), open_flags, 0644));
if (-1 == result)