public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCHv2] time/tst-clock2.c: clock_settime CLOCK_MONOTONIC might return EPERM
@ 2022-06-27 10:48 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2022-06-27 10:48 UTC (permalink / raw)
  To: libc-alpha; +Cc: Mark Wielaard

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(-)

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;
-- 
2.18.4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-27 10:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-27 10:48 [PATCHv2] time/tst-clock2.c: clock_settime CLOCK_MONOTONIC might return EPERM Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).