* tests/test-linkat.c (main): Don’t lose the failure results of
earlier tests.  Problem found by Coverity.
---
 ChangeLog           |  4 ++++
 tests/test-linkat.c | 15 +++++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 997f51f3b5..ea799492a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2024-05-20  Paul Eggert  <egg...@cs.ucla.edu>
 
+       linkat-tests: fix up assertion-failure changes
+       * tests/test-linkat.c (main): Don’t lose the failure results of
+       earlier tests.  Problem found by Coverity.
+
        dfa: attempt to pacify Coverity
        * lib/dfa.c (lex): Use ‘assume’ rather than ‘abort’,
        to try to pacify Coverity.
diff --git a/tests/test-linkat.c b/tests/test-linkat.c
index c3efb5df60..04814ddd1b 100644
--- a/tests/test-linkat.c
+++ b/tests/test-linkat.c
@@ -141,7 +141,7 @@ main (void)
   /* Skip the rest of the test if the file system does not support hard links
      and symlinks.  */
   if (result)
-    return result;
+    return test_exit_status ? test_exit_status : result;
 
   /* Create locations to manipulate.  */
   ASSERT (mkdir (BASE "sub1", 0700) == 0);
@@ -202,10 +202,13 @@ main (void)
       ASSERT (rmdir (BASE "sub1") == 0);
       ASSERT (rmdir (BASE "sub2") == 0);
       free (cwd);
-      if (!result)
-        fputs ("skipping test: symlinks not supported on this file system\n",
-               stderr);
-      return result;
+      if (!test_exit_status)
+        {
+          fputs ("skipping test: symlinks not supported on this file system\n",
+                 stderr);
+          return 77;
+        }
+      return test_exit_status;
     }
   dfd = open (".", O_RDONLY);
   ASSERT (0 <= dfd);
@@ -384,5 +387,5 @@ main (void)
   ASSERT (unlink (BASE "link5") == 0);
   free (cwd);
 
-  return (result ? result : test_exit_status);
+  return test_exit_status;
 }
-- 
2.40.1


Reply via email to