aboutsummaryrefslogtreecommitdiff
path: root/gdb/common/filestuff.h
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2017-09-22 17:00:33 -0300
committerAlexandre Oliva <aoliva@redhat.com>2017-09-22 17:00:33 -0300
commit9e0703de64a6dd4deae2ebd569955f14337f2710 (patch)
treecec45139f1febef6441deabae142c3fb3f2c61f3 /gdb/common/filestuff.h
parent13b9f79a1904081d984a64037af6457c1e3ff7b6 (diff)
parent43573013c9836f2b91b74b9b29dac35fdb41e06b (diff)
downloadgdb-9e0703de64a6dd4deae2ebd569955f14337f2710.zip
gdb-9e0703de64a6dd4deae2ebd569955f14337f2710.tar.gz
gdb-9e0703de64a6dd4deae2ebd569955f14337f2710.tar.bz2
Merge remote-tracking branch 'remotes/master' into users/aoliva/SFN
Updated local changes to binutils/testsuite/binutils-all/readelf.exp to match the unresolved (failed to assemble) messages introduced by Alan Modra.
Diffstat (limited to 'gdb/common/filestuff.h')
-rw-r--r--gdb/common/filestuff.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/gdb/common/filestuff.h b/gdb/common/filestuff.h
index b0a811b..3cf2df6 100644
--- a/gdb/common/filestuff.h
+++ b/gdb/common/filestuff.h
@@ -46,10 +46,23 @@ extern void close_most_fds (void);
extern int gdb_open_cloexec (const char *filename, int flags,
/* mode_t */ unsigned long mode);
+struct gdb_file_deleter
+{
+ void operator() (FILE *file) const
+ {
+ fclose (file);
+ }
+};
+
+/* A unique pointer to a FILE. */
+
+typedef std::unique_ptr<FILE, gdb_file_deleter> gdb_file_up;
+
/* Like 'fopen', but ensures that the returned file descriptor has the
close-on-exec flag set. */
-extern FILE *gdb_fopen_cloexec (const char *filename, const char *opentype);
+extern gdb_file_up gdb_fopen_cloexec (const char *filename,
+ const char *opentype);
/* Like 'socketpair', but ensures that the returned file descriptors
have the close-on-exec flag set. */