public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: libc-alpha@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCHv2] time/tst-clock2.c: clock_settime CLOCK_MONOTONIC might return EPERM
Date: Mon, 27 Jun 2022 12:48:26 +0200	[thread overview]
Message-ID: <20220627104826.4303-1-mark@klomp.org> (raw)

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


                 reply	other threads:[~2022-06-27 10:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220627104826.4303-1-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).