diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-07-22 15:33:42 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-09-30 15:21:48 -0400 |
commit | 2fed9db40b1179f62c6fb0f2cacfb0db6b50af46 (patch) | |
tree | d47c517c106ec8bc88b6733d2b26f54f50dfec7c /gdbsupport/filestuff.h | |
parent | 13084383e8955c2ff7017ac8839301688a9ee34d (diff) | |
download | gdb-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/filestuff.h')
-rw-r--r-- | gdbsupport/filestuff.h | 4 |
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 |