aboutsummaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-04-08 07:39:32 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-04-12 18:38:37 -0300
commitcedbf6d5f3f70ca911176de87d6e453eeab4b7a1 (patch)
treeda19070ed554fc60b8d9f8085f675d68953dc45e /misc
parent9d7c5cc38e58fb0923e88901f87174a511b61552 (diff)
downloadglibc-cedbf6d5f3f70ca911176de87d6e453eeab4b7a1.zip
glibc-cedbf6d5f3f70ca911176de87d6e453eeab4b7a1.tar.gz
glibc-cedbf6d5f3f70ca911176de87d6e453eeab4b7a1.tar.bz2
linux: always update select timeout (BZ #27706)
The timeout should be updated even on failure for time64 support. Checked on i686-linux-gnu.
Diffstat (limited to 'misc')
-rw-r--r--misc/tst-select.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/misc/tst-select.c b/misc/tst-select.c
index 534105b..52aa266 100644
--- a/misc/tst-select.c
+++ b/misc/tst-select.c
@@ -23,6 +23,7 @@
#include <support/timespec.h>
#include <support/xunistd.h>
#include <support/xtime.h>
+#include <support/xsignal.h>
struct child_args
{
@@ -31,6 +32,12 @@ struct child_args
};
static void
+alarm_handler (int signum)
+{
+ /* Do nothing. */
+}
+
+static void
do_test_child (void *clousure)
{
struct child_args *args = (struct child_args *) clousure;
@@ -59,6 +66,22 @@ do_test_child (void *clousure)
xwrite (args->fds[1][1], "foo", 3);
}
+static void
+do_test_child_alarm (void *clousure)
+{
+ struct sigaction act = { .sa_handler = alarm_handler };
+ xsigaction (SIGALRM, &act, NULL);
+ alarm (1);
+
+ struct timeval tv = { .tv_sec = 10, .tv_usec = 0 };
+ int r = select (0, NULL, NULL, NULL, &tv);
+ TEST_COMPARE (r, -1);
+ TEST_COMPARE (errno, EINTR);
+
+ if (support_select_modifies_timeout ())
+ TEST_VERIFY (tv.tv_sec < 10);
+}
+
static int
do_test (void)
{
@@ -99,6 +122,13 @@ do_test (void)
xclose (args.fds[1][1]);
{
+ struct support_capture_subprocess result;
+ result = support_capture_subprocess (do_test_child_alarm, NULL);
+ support_capture_subprocess_check (&result, "tst-select-child", 0,
+ sc_allow_none);
+ }
+
+ {
fd_set rfds;
FD_ZERO (&rfds);
FD_SET (args.fds[1][0], &rfds);