]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
test: fix cleanup_test_socket_tempdir on Solaris
authorAlan Coopersmith <alan.coopersmith@oracle.com>
Tue, 15 Oct 2024 22:18:13 +0000 (15:18 -0700)
committerSimon McVittie <smcv@collabora.com>
Fri, 18 Oct 2024 14:16:26 +0000 (14:16 +0000)
Solaris does not allow rmdir() to remove the cwd, so chdir() out of
the tempdir before removing it.

Without this fix, misc-internal reported a failure on Solaris 11.4:
not ok 16 - failed to remove test socket directory /tmp/dbus-test-tduvWc

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
test/internals/misc-internals.c

index 1b26e34c8db555cfbaa2b9a349cef729d8af00db..6daa97c3553a3b12b13d702143325c6909b819bd 100644 (file)
@@ -726,6 +726,8 @@ static char test_socket_dir[] = DBUS_TEST_SOCKET_DIR "/dbus-test-XXXXXX";
 static void
 cleanup_test_socket_tempdir (void)
 {
+  if (chdir ("/tmp") != 0)
+    _dbus_test_fatal ("Failed to chdir() to /tmp");
   if (rmdir (test_socket_dir) != 0)
     _dbus_test_not_ok ("failed to remove test socket directory %s",
                        test_socket_dir);