aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorFrédéric Bérat <fberat@redhat.com>2023-06-01 16:27:47 +0200
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2023-06-01 13:01:32 -0400
commit29e25f6f136182fb3756d51e03dea7c4d1919dd9 (patch)
tree4d3950068c9fec569ae21055641b986632371fbb /stdlib
parenta952fcda58cd7aa191140fc9e7d453df212b9117 (diff)
downloadglibc-29e25f6f136182fb3756d51e03dea7c4d1919dd9.tar
glibc-29e25f6f136182fb3756d51e03dea7c4d1919dd9.tar.gz
glibc-29e25f6f136182fb3756d51e03dea7c4d1919dd9.tar.bz2
glibc-29e25f6f136182fb3756d51e03dea7c4d1919dd9.zip
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 <siddhesh@sourceware.org>
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/test-canon.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/stdlib/test-canon.c b/stdlib/test-canon.c
index 4edee73dd8..bf19b1f1b1 100644
--- a/stdlib/test-canon.c
+++ b/stdlib/test-canon.c
@@ -123,8 +123,13 @@ do_test (int argc, char ** argv)
int i, errors = 0;
char buf[PATH_MAX];
- getcwd (cwd, sizeof (buf));
- cwd_len = strlen (cwd);
+ if (getcwd (cwd, sizeof (buf)))
+ cwd_len = strlen (cwd);
+ else
+ {
+ printf ("%s: current working directory couldn't be retrieved\n", argv[0]);
+ ++errors;
+ }
errno = 0;
if (realpath (NULL, buf) != NULL || errno != EINVAL)
@@ -205,7 +210,12 @@ do_test (int argc, char ** argv)
free (result2);
}
- getcwd (buf, sizeof (buf));
+ if (!getcwd (buf, sizeof (buf)))
+ {
+ printf ("%s: current working directory couldn't be retrieved\n", argv[0]);
+ ++errors;
+ }
+
if (strcmp (buf, cwd))
{
printf ("%s: current working directory changed from %s to %s\n",