[PATCHv2] time/tst-clock2.c: clock_settime CLOCK_MONOTONIC might return EPERM

Message ID 20220627104826.4303-1-mark@klomp.org
State New
Headers
Series [PATCHv2] time/tst-clock2.c: clock_settime CLOCK_MONOTONIC might return EPERM |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686
redhat-pt-bot/TryBot-still_applies warning Patch no longer applies to master

Commit Message

Mark Wielaard June 27, 2022, 10:48 a.m. UTC
  clock_settime can return errno EPERM if it does not have permission
to set the clock indicated. The test expects setting the monotonic
clock must fail. Which it does. But the errno can be either EINVAL
or EPERM.
---

v2: add %m and split too long printf line.

https://code.wildebeest.org/git/user/mjw/glibc/commit/?h=container-perms&id=d90b0d2ac7cb14d035d2ade47ca1115486888b63

 time/tst-clock2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Patch

diff --git a/time/tst-clock2.c b/time/tst-clock2.c
index 4c8fb9f247..fd052f13ec 100644
--- a/time/tst-clock2.c
+++ b/time/tst-clock2.c
@@ -27,10 +27,10 @@  do_test (void)
       puts ("clock_settime(CLOCK_MONOTONIC) did not fail");
       return 1;
     }
-  if (errno != EINVAL)
+  if (errno != EINVAL && errno != EPERM)
     {
-      printf ("clock_settime(CLOCK_MONOTONIC) set errno to %d, expected %d\n",
-	      errno, EINVAL);
+      printf ("clock_settime(CLOCK_MONOTONIC) set errno to %d (%m),"
+	      " expected %d or %d\n", errno, EINVAL, EPERM);
       return 1;
     }
   return 0;