aboutsummaryrefslogtreecommitdiff
path: root/gdb/common
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-09-18 16:45:59 -0600
committerTom Tromey <tom@tromey.com>2018-09-23 12:11:16 -0600
commit65773341ee5ad9e2882fcb1aed7c3096e6b4f190 (patch)
tree29432c01b92dce80017c39d9a25e310c5d6ec10e /gdb/common
parent1db88d2272a776200db950c2af46e64e98ef056b (diff)
downloadbinutils-65773341ee5ad9e2882fcb1aed7c3096e6b4f190.zip
binutils-65773341ee5ad9e2882fcb1aed7c3096e6b4f190.tar.gz
binutils-65773341ee5ad9e2882fcb1aed7c3096e6b4f190.tar.bz2
Mark more file descriptors close-on-exec
I noticed a couple of spots in gdb that were opening files but not marking the file descriptors as close-on-exec. This patch fixes these. There are still a few more of these, but they are in code that I can't compile, so I'd prefer not to touch. gdb/ChangeLog 2018-09-23 Tom Tromey <tom@tromey.com> * ctf.c (ctf_start): Use gdb_fopen_cloexec. * common/scoped_mmap.c (mmap_file): Use gdb_open_cloexec.
Diffstat (limited to 'gdb/common')
-rw-r--r--gdb/common/scoped_mmap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/common/scoped_mmap.c b/gdb/common/scoped_mmap.c
index 7eb7293..e1fffb9 100644
--- a/gdb/common/scoped_mmap.c
+++ b/gdb/common/scoped_mmap.c
@@ -20,13 +20,14 @@
#include "defs.h"
#include "scoped_mmap.h"
#include "scoped_fd.h"
+#include "common/filestuff.h"
#ifdef HAVE_SYS_MMAN_H
scoped_mmap
mmap_file (const char *filename)
{
- scoped_fd fd (open (filename, O_RDONLY));
+ scoped_fd fd (gdb_open_cloexec (filename, O_RDONLY, 0));
if (fd.get () < 0)
perror_with_name (("open"));