S390: Fix building with --disable-mutli-arch [BZ #31196]
[platform/upstream/glibc.git] / rt / tst-mqueue2.c
index 78ec4c8..5a2a3bf 100644 (file)
@@ -1,7 +1,6 @@
 /* Test message queue passing.
-   Copyright (C) 2004-2015 Free Software Foundation, Inc.
+   Copyright (C) 2004-2024 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -15,7 +14,7 @@
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
+   <https://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
 #include <fcntl.h>
@@ -28,6 +27,7 @@
 #include <sys/wait.h>
 #include <time.h>
 #include <unistd.h>
+#include <support/check.h>
 #include "tst-mqueue.h"
 
 static void
@@ -35,7 +35,6 @@ alrm_handler (int sig)
 {
 }
 
-#define TIMEOUT 10
 #define TEST_FUNCTION do_test ()
 static int
 do_test (void)
@@ -50,11 +49,14 @@ do_test (void)
 
   if (q == (mqd_t) -1)
     {
+      if (errno == ENOSYS)
+       FAIL_UNSUPPORTED ("mq_open not supported");
+
       printf ("mq_open failed with: %m\n");
-      return result;
+      return 1;
     }
-  else
-    add_temp_mq (name);
+
+  add_temp_mq (name);
 
   mqd_t q2 = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
   if (q2 != (mqd_t) -1)
@@ -461,12 +463,12 @@ do_test (void)
 
   if (mq_unlink ("/tst-mqueue2-which-should-never-exist") != -1)
     {
-      puts ("mq_unlink of non-existant message queue unexpectedly succeeded");
+      puts ("mq_unlink of non-existent message queue unexpectedly succeeded");
       result = 1;
     }
   else if (errno != ENOENT)
     {
-      printf ("mq_unlink of non-existant message queue did not fail with "
+      printf ("mq_unlink of non-existent message queue did not fail with "
              "ENOENT: %m\n");
       result = 1;
     }