From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2206) id D5A693857714; Tue, 6 Jun 2023 12:24:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5A693857714 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1686054257; bh=31sJoV8wbtA9xsoLc4OrptY2Nmi2rsTkOv/xA/jlrl4=; h=From:To:Subject:Date:From; b=lePPTirPl7ovfjwlj3FKmrE+1/A4gepqZsP8i5NohoJpgH8YF9IPUMWfj1rtGyl03 a76F/6pJ7UIkW7aZftAkdxcZycYwQJ0PWoLaVuAQO5nN9VluMrfbEH/kqmVjBDN5zd DMMXih2Bz1EzpA+02s31oLPs9rXwUCePHc39wuSo= MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: Siddhesh Poyarekar To: glibc-cvs@sourceware.org Subject: [glibc] tests: Replace various function calls with their x variant X-Act-Checkin: glibc X-Git-Author: =?utf-8?b?RnLDqWTDqXJpYyBCw6lyYXQ=?= X-Git-Refname: refs/heads/master X-Git-Oldrev: 8c4f69d711481a18c70cb9a6c0a5367604894320 X-Git-Newrev: f6a532fbd0f430dc4ded254d713d89fcbafc1b7e Message-Id: <20230606122417.D5A693857714@sourceware.org> Date: Tue, 6 Jun 2023 12:24:17 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f6a532fbd0f430dc4ded254d713d89fcbafc1b7e commit f6a532fbd0f430dc4ded254d713d89fcbafc1b7e Author: Frédéric Bérat Date: Fri Jun 2 17:28:11 2023 +0200 tests: Replace various function calls with their x variant With fortification enabled, few function calls return result need to be checked, has they get the __wur macro enabled. Reviewed-by: Siddhesh Poyarekar Diff: --- misc/tst-error1.c | 4 +++- nss/tst-reload2.c | 2 +- posix/tst-chmod.c | 7 +++++-- posix/wordexp-test.c | 2 +- stdlib/test-canon.c | 4 +++- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/misc/tst-error1.c b/misc/tst-error1.c index 9c4a62fbd0..75d4edf476 100644 --- a/misc/tst-error1.c +++ b/misc/tst-error1.c @@ -5,11 +5,13 @@ #include #include +#include + static int do_test (int argc, char *argv[]) { mtrace (); - (void) freopen (argc == 1 ? "/dev/stdout" : argv[1], "a", stderr); + xfreopen (argc == 1 ? "/dev/stdout" : argv[1], "a", stderr); /* Orient the stream. */ fwprintf (stderr, L"hello world\n"); char buf[20000]; diff --git a/nss/tst-reload2.c b/nss/tst-reload2.c index ba9b5b7687..89cc9ea242 100644 --- a/nss/tst-reload2.c +++ b/nss/tst-reload2.c @@ -121,7 +121,7 @@ do_test (void) /* Change the root dir. */ TEST_VERIFY (chroot ("/subdir") == 0); - chdir ("/"); + xchdir ("/"); /* Check we're NOT using the "inner" nsswitch.conf. */ diff --git a/posix/tst-chmod.c b/posix/tst-chmod.c index b98a05a265..470a696fe5 100644 --- a/posix/tst-chmod.c +++ b/posix/tst-chmod.c @@ -27,6 +27,8 @@ #include #include +#include + #define OUT_OF_MEMORY \ do { \ @@ -229,7 +231,8 @@ do_test (int argc, char *argv[]) close (fd); snprintf (buf, buflen, "%s/..", testdir); - chdir (buf); + xchdir (buf); + /* We are now in the directory above the one we create the test directory in. */ @@ -349,7 +352,7 @@ do_test (int argc, char *argv[]) } fail: - chdir (startdir); + xchdir (startdir); /* Remove all the files. */ chmod (testdir, 0700); diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c index 524597d96b..28d1d1509b 100644 --- a/posix/wordexp-test.c +++ b/posix/wordexp-test.c @@ -336,7 +336,7 @@ do_test (int argc, char *argv[]) if (cwd == NULL) cwd = ".."; - chdir (cwd); + xchdir (cwd); rmdir (tmpdir); return 0; diff --git a/stdlib/test-canon.c b/stdlib/test-canon.c index bf19b1f1b1..2874258722 100644 --- a/stdlib/test-canon.c +++ b/stdlib/test-canon.c @@ -27,6 +27,8 @@ #include #include +#include + /* Prototype for our test function. */ extern int do_test (int argc, char *argv[]); #include @@ -159,7 +161,7 @@ do_test (int argc, char ** argv) } for (i = 0; i < (int) (sizeof (symlinks) / sizeof (symlinks[0])); ++i) - symlink (symlinks[i].value, symlinks[i].name); + xsymlink (symlinks[i].value, symlinks[i].name); int has_dir = mkdir ("doesExist", 0777) == 0;