From 29e25f6f136182fb3756d51e03dea7c4d1919dd9 Mon Sep 17 00:00:00 2001 From: Frédéric Bérat Date: Thu, 1 Jun 2023 16:27:47 +0200 Subject: tests: fix warn unused results With fortification enabled, few function calls return result need to be checked, has they get the __wur macro enabled. Reviewed-by: Siddhesh Poyarekar --- posix/tst-nice.c | 3 +-- posix/wordexp-test.c | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'posix') diff --git a/posix/tst-nice.c b/posix/tst-nice.c index fe9888b3f6..59cf953e27 100644 --- a/posix/tst-nice.c +++ b/posix/tst-nice.c @@ -58,8 +58,7 @@ do_test (void) /* BZ #18086. Make sure we don't reset errno. */ errno = EBADF; - nice (0); - if (errno != EBADF) + if (nice (0) == -1 || errno != EBADF) { printf ("FAIL: errno = %i, but wanted EBADF (%i)\n", errno, EBADF); return 1; diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c index bae27d6cee..524597d96b 100644 --- a/posix/wordexp-test.c +++ b/posix/wordexp-test.c @@ -253,7 +253,11 @@ do_test (int argc, char *argv[]) cwd = getcwd (NULL, 0); /* Set up arena for pathname expansion */ - tmpnam (tmpdir); + if (!tmpnam (tmpdir)) + { + printf ("Failed to create a temporary directory with a unique name: %m"); + return 1; + } xmkdir (tmpdir, S_IRWXU); TEST_VERIFY_EXIT (chdir (tmpdir) == 0); -- cgit 1.4.1