From cc89492a617a0084dece04fb5d5119a51ac45c84 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 27 Apr 2024 02:22:05 +0200 Subject: [PATCH] login_tty tests: Avoid gcc warnings. * tests/test-login_tty.c: Include ignore-value.h. (main): Ignore the results of the freopen calls. * modules/login_tty-tests (Depends-on): Add ignore-value. --- ChangeLog | 7 +++++++ modules/login_tty-tests | 1 + tests/test-login_tty.c | 8 +++++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c1350bece4..fc204db052 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-04-26 Bruno Haible + + login_tty tests: Avoid gcc warnings. + * tests/test-login_tty.c: Include ignore-value.h. + (main): Ignore the results of the freopen calls. + * modules/login_tty-tests (Depends-on): Add ignore-value. + 2024-04-24 Paul Eggert c32srtombs,mbsrtoc32s,mbsrtowcs,wcsrtombs: pacify GCC 14 diff --git a/modules/login_tty-tests b/modules/login_tty-tests index 306b0ebe12..aaad143c10 100644 --- a/modules/login_tty-tests +++ b/modules/login_tty-tests @@ -4,6 +4,7 @@ tests/test-login_tty.c Depends-on: openpty tcgetsid +ignore-value configure.ac: diff --git a/tests/test-login_tty.c b/tests/test-login_tty.c index 6f3b25c6d4..ac3b405893 100644 --- a/tests/test-login_tty.c +++ b/tests/test-login_tty.c @@ -26,6 +26,8 @@ #include #include +#include "ignore-value.h" + int main () { @@ -63,7 +65,7 @@ main () for (fd = 0; fd < 3; fd++) if (!(tcgetpgrp (fd) == getpid ())) { - freopen ("err", "w+", stderr); + ignore_value (freopen ("err", "w+", stderr)); fprintf (stderr, "tcgetpgrp(%d) = %ld whereas getpid() = %ld\n", fd, (long) tcgetpgrp (fd), (long) getpid ()); fflush (stderr); @@ -76,7 +78,7 @@ main () { if (!(errno == ENOSYS)) { - freopen ("err", "w+", stderr); + ignore_value (freopen ("err", "w+", stderr)); fprintf (stderr, "tcgetsid(%d) = -1 and errno = %d\n", fd, errno); fflush (stderr); @@ -87,7 +89,7 @@ main () { if (!(sid == getpid ())) { - freopen ("err", "w+", stderr); + ignore_value (freopen ("err", "w+", stderr)); fprintf (stderr, "tcgetsid(%d) = %ld whereas getpid() = %ld\n", fd, (long) tcgetsid (fd), (long) getpid ()); fflush (stderr); -- 2.39.5