From e627524af9ae499c1edd04795442f8bdb05b5223 Mon Sep 17 00:00:00 2001 From: Colin Walters <walters@verbum.org> Date: Wed, 11 Oct 2017 17:06:40 -0400 Subject: [PATCH] fdio: Avoid ?: syntax for fstatat_allow_noent() `g-ir-scanner` is unaware of this GNUC extension and complains. Saw that while building ostree. While we're here, fix up a few other things: - Tell the compiler the stat buffer is unused (I didn't see a warning, just doing this on general principle) - Return from `glnx_throw_errno_prefix()` directly; we do preserve errno there, let's feel free to rely on it. --- glnx-fdio.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/glnx-fdio.h b/glnx-fdio.h index 1aa0c4346..dc93b6877 100644 --- a/glnx-fdio.h +++ b/glnx-fdio.h @@ -318,16 +318,12 @@ glnx_fstatat_allow_noent (int dfd, int flags, GError **error) { - struct stat stbuf; - if (TEMP_FAILURE_RETRY (fstatat (dfd, path, out_buf ?: &stbuf, flags)) != 0) + G_GNUC_UNUSED struct stat unused_stbuf; + if (TEMP_FAILURE_RETRY (fstatat (dfd, path, out_buf ? out_buf : &unused_stbuf, flags)) != 0) { if (errno != ENOENT) - { - int errsv = errno; - (void) glnx_throw_errno_prefix (error, "fstatat(%s)", path); - errno = errsv; - return FALSE; - } + return glnx_throw_errno_prefix (error, "fstatat(%s)", path); + /* Note we preserve errno as ENOENT */ } else errno = 0; -- GitLab