* select_tut(2): error in example code
@ 2010-06-08 15:41 Andrew Klossner
[not found] ` <201006081541.o58FfQTt015276-1qr3+Ib8l7hP+3OIzQSClA49vMN11MuG@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Klossner @ 2010-06-08 15:41 UTC (permalink / raw)
To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA
The select_tut(2) EXAMPLE has a one-character bug:
/* NB: read oob data before normal reads */
if (fd1 > 0)
if (FD_ISSET(fd1, &er)) {
char c;
r = recv(fd1, &c, 1, MSG_OOB);
if (r < 1)
SHUT_FD1;
else
send(fd2, &c, 1, MSG_OOB);
}
if (fd2 > 0)
if (FD_ISSET(fd2, &er)) {
char c;
r = recv(fd2, &c, 1, MSG_OOB);
if (r < 1)
+-> SHUT_FD1;
| else
| send(fd1, &c, 1, MSG_OOB);
| }
|
+-- should be SHUT_FD2;
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: select_tut(2): error in example code
[not found] ` <201006081541.o58FfQTt015276-1qr3+Ib8l7hP+3OIzQSClA49vMN11MuG@public.gmane.org>
@ 2010-06-10 4:10 ` Michael Kerrisk
0 siblings, 0 replies; 2+ messages in thread
From: Michael Kerrisk @ 2010-06-10 4:10 UTC (permalink / raw)
To: Andrew Klossner; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA
Hello Andrew,
On Tue, Jun 8, 2010 at 5:41 PM, Andrew Klossner
<andrew-pwabbKueSRu4mpay0g/RMEEOCMrvLtNR@public.gmane.org> wrote:
> The select_tut(2) EXAMPLE has a one-character bug:
>
> /* NB: read oob data before normal reads */
>
> if (fd1 > 0)
> if (FD_ISSET(fd1, &er)) {
> char c;
>
> r = recv(fd1, &c, 1, MSG_OOB);
> if (r < 1)
> SHUT_FD1;
> else
> send(fd2, &c, 1, MSG_OOB);
> }
> if (fd2 > 0)
> if (FD_ISSET(fd2, &er)) {
> char c;
>
> r = recv(fd2, &c, 1, MSG_OOB);
> if (r < 1)
> +-> SHUT_FD1;
> | else
> | send(fd1, &c, 1, MSG_OOB);
> | }
> |
> +-- should be SHUT_FD2;
Thanks. Fixed for man-pages-3.25.
Cheers,
Michael
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface" http://blog.man7.org/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-06-10 4:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-08 15:41 select_tut(2): error in example code Andrew Klossner
[not found] ` <201006081541.o58FfQTt015276-1qr3+Ib8l7hP+3OIzQSClA49vMN11MuG@public.gmane.org>
2010-06-10 4:10 ` Michael Kerrisk
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 NNTP newsgroup(s).