summaryrefslogtreecommitdiff
path: root/test/test-utils-glib.c
diff options
context:
space:
mode:
authorAlex Richardson <arichardson@FreeBSD.org>2022-08-08 20:38:31 +0000
committerSimon McVittie <smcv@collabora.com>2022-08-10 11:18:20 +0000
commitaec2ad7efbb2bae20808878790462b92d1f87d4d (patch)
tree0dadfe4de1319d7d5b39d5d774642dba42c88927 /test/test-utils-glib.c
parentcf51eeb555dea1825b27a581b90f4bb5fc09759c (diff)
downloaddbus-aec2ad7efbb2bae20808878790462b92d1f87d4d.tar.gz
test-utils-glibc.c: Fix -Werror,-Wmissing-noreturn on FreeBSD
Add a conditional _DBUS_GNUC_NORETURN to avoid `error: function 'back_to_root' could be declared with attribute 'noreturn'`
Diffstat (limited to 'test/test-utils-glib.c')
-rw-r--r--test/test-utils-glib.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/test-utils-glib.c b/test/test-utils-glib.c
index c6383af5..d0f7cdc0 100644
--- a/test/test-utils-glib.c
+++ b/test/test-utils-glib.c
@@ -553,16 +553,20 @@ become_other_user (TestUser user,
}
/* Undo the effect of a successful call to become_other_user() */
+#if defined(HAVE_GETRESUID) && defined(HAVE_SETRESUID) && defined(__linux__)
static void
back_to_root (void)
{
-#if defined(HAVE_GETRESUID) && defined(HAVE_SETRESUID) && defined(__linux__)
- if (setresuid (0, 0, 0) != 0)
- g_error ("setresuid(0, 0, 0): %s", g_strerror (errno));
+ if (setresuid(0, 0, 0) != 0)
+ g_error ("setresuid(0, 0, 0): %s", g_strerror(errno));
+}
#else
+_DBUS_GNUC_NORETURN static void
+back_to_root (void)
+{
g_error ("become_other_user() cannot succeed on this platform");
-#endif
}
+#endif
/*
* Raise G_IO_ERROR_NOT_SUPPORTED if the requested user is impossible.