[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250515205016.90052-1-kuniyu@amazon.com>
Date: Thu, 15 May 2025 13:50:08 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <willemdebruijn.kernel@...il.com>
CC: <brauner@...nel.org>, <davem@...emloft.net>, <edumazet@...gle.com>,
<horms@...nel.org>, <kuba@...nel.org>, <kuni1840@...il.com>,
<kuniyu@...zon.com>, <netdev@...r.kernel.org>, <pabeni@...hat.com>,
<willemb@...gle.com>
Subject: Re: [PATCH v3 net-next 9/9] selftest: af_unix: Test SO_PASSRIGHTS.
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
Date: Thu, 15 May 2025 15:27:22 -0400
> > @@ -227,10 +297,18 @@ void __send_fd(struct __test_metadata *_metadata,
> > .msg_control = &cmsg,
> > .msg_controllen = CMSG_SPACE(sizeof(cmsg.fd)),
> > };
> > - int ret;
> > + int ret, saved_errno;
> >
> > + errno = 0;
> > ret = sendmsg(self->fd[receiver * 2 + 1], &msg, variant->flags);
> > - ASSERT_EQ(MSGLEN, ret);
> > + saved_errno = errno;
> > +
> > + if (variant->disabled) {
> > + ASSERT_EQ(-1, ret);
> > + ASSERT_EQ(-EPERM, -saved_errno);
> > + } else {
> > + ASSERT_EQ(MSGLEN, ret);
> > + }
>
> Why is this errno complexity needed?
>
> It should never be needed to manually reset errno.
>
> Is the saved_errno there because ASSERT_EQ on ret could call a libc
> function that resets errno?
I guess it's paranoid here.
When ASSERT_EQ() calls TH_LOG(), it always fails and does
not reach the 2nd ASSERT_EQ().
Will remove them.
Thanks!
Powered by blists - more mailing lists