[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1445616011.22974.158.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Fri, 23 Oct 2015 09:00:11 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Alan Burlison <Alan.Burlison@...cle.com>
Cc: Casper.Dik@...cle.com, Al Viro <viro@...IV.linux.org.uk>,
David Miller <davem@...emloft.net>, stephen@...workplumber.org,
netdev@...r.kernel.org, dholland-tech@...bsd.org
Subject: Re: [Bug 106241] New: shutdown(3)/close(3) behaviour is incorrect
for sockets in accept(3)
On Fri, 2015-10-23 at 16:46 +0100, Alan Burlison wrote:
> On 23/10/2015 15:21, Eric Dumazet wrote:
>
> > I claim nothing. If you believe a man page should be fixed, please send
> > a patch to man page maintainer.
>
> Ermm, you *really* want me to submit a patch removing 'Conforms to
> POSIX.1-2001' from *every* Linux manpage?
Only on the pages you think there is an error that matters.
>
> > Have you tested the patch I sent ?
>
> The AF_UNIX poll one? No, I don't have the means to do so, and in any
> case that's not a POSIX issue, just a plain bug. I'm happy to log a bug
> if that helps.
We submit patches when someone needs a fix.
If not, we have more urgent issues to solve first.
I wrote following test case, and confirmed the patch fixes the issue.
I will submit it formally.
Thanks.
#include <pthread.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <poll.h>
static void fail(const char *str)
{
perror(str);
printf("FAIL\n");
exit(1);
}
int main(int argc, char *argv[])
{
int listener = socket(AF_UNIX, SOCK_STREAM, 0);
struct pollfd pfd;
struct sockaddr_un addr;
int res;
if (listener == -1)
perror("socket()");
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
if (bind(listener, (struct sockaddr *)&addr, sizeof(addr)) == -1)
fail("bind()");
if (listen(listener, 10) == -1)
fail("listen()");
pfd.fd = listener;
pfd.events = -1;
res = poll(&pfd, 1, 10);
if (res == -1)
fail("poll()");
if (res == 1 && pfd.revents & (POLLOUT|POLLWRNORM|POLLWRBAND)) {
fprintf(stderr, "poll(af_unix listener) returned a POLLOUT status !\n");
printf("FAIL\n");
return 1;
}
printf("OK\n");
return 0;
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists