diff --git a/glnx-fdio.h b/glnx-fdio.h index 601e7936d9a0b03978ecb017b8d66347c95feb83..d6352b23117236eac5b1c0d3de577d85994bb5e9 100644 --- a/glnx-fdio.h +++ b/glnx-fdio.h @@ -241,6 +241,28 @@ glnx_fstat (int fd, return TRUE; } +/** + * 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