diff options
author | Colin Walters <walters@verbum.org> | 2017-07-11 10:32:11 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2017-07-17 12:12:14 -0400 |
commit | 547bcea280b389b244d52bf052f627e31bf210a9 (patch) | |
tree | 54296d6304e575aac0c44bcf3320c5afbbdf36d5 /glnx-fdio.h | |
parent | 8b75c8e341279032e34a1d496b2181362db3e6b8 (diff) | |
download | libglnx-547bcea280b389b244d52bf052f627e31bf210a9.tar.gz |
fdio: Add a fchmod wrapper
There are a number of versions of this in ostree at least, might as well wrap
it.
Diffstat (limited to 'glnx-fdio.h')
-rw-r--r-- | glnx-fdio.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/glnx-fdio.h b/glnx-fdio.h index 601e793..d6352b2 100644 --- a/glnx-fdio.h +++ b/glnx-fdio.h @@ -242,6 +242,28 @@ glnx_fstat (int fd, } /** + * glnx_fchmod: + * @fd: FD + * @mode: Mode + * @error: Return location for a #GError, or %NULL + * + * Wrapper around fchmod() which adds #GError support and ensures that it + * retries on %EINTR. + * + * Returns: %TRUE on success, %FALSE otherwise + * Since: UNRELEASED + */ +static inline gboolean +glnx_fchmod (int fd, + mode_t mode, + GError **error) +{ + if (TEMP_FAILURE_RETRY (fchmod (fd, mode)) != 0) + return glnx_throw_errno_prefix (error, "fchmod"); + return TRUE; +} + +/** * glnx_fstatat: * @dfd: Directory FD to stat beneath * @path: Path to stat beneath @dfd |