aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-07-22 15:33:42 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-09-30 15:21:48 -0400
commit2fed9db40b1179f62c6fb0f2cacfb0db6b50af46 (patch)
treed47c517c106ec8bc88b6733d2b26f54f50dfec7c /gdbsupport
parent13084383e8955c2ff7017ac8839301688a9ee34d (diff)
downloadgdb-2fed9db40b1179f62c6fb0f2cacfb0db6b50af46.zip
gdb-2fed9db40b1179f62c6fb0f2cacfb0db6b50af46.tar.gz
gdb-2fed9db40b1179f62c6fb0f2cacfb0db6b50af46.tar.bz2
gdbsupport: make gdb_mkostemp_cloexec return a scoped_fd
This encourages the callers to use automatic file descriptor management. Change-Id: I137a81df6f3607b457e28c35aafde8ed6f3a3344
Diffstat (limited to 'gdbsupport')
-rw-r--r--gdbsupport/filestuff.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdbsupport/filestuff.h b/gdbsupport/filestuff.h
index a2cb916..10e9eba 100644
--- a/gdbsupport/filestuff.h
+++ b/gdbsupport/filestuff.h
@@ -54,11 +54,11 @@ extern scoped_fd gdb_open_cloexec (const char *filename, int flags,
/* Like mkstemp, but ensures that the file descriptor is
close-on-exec. */
-static inline int
+static inline scoped_fd
gdb_mkostemp_cloexec (char *name_template, int flags = 0)
{
/* gnulib provides a mkostemp replacement if needed. */
- return mkostemp (name_template, flags | O_CLOEXEC);
+ return scoped_fd (mkostemp (name_template, flags | O_CLOEXEC));
}
/* Convenience wrapper for the above, which takes the filename as an