[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-man
Subject:    Re: select_tut(2): error in example code
From:       Michael Kerrisk <mtk.manpages () googlemail ! com>
Date:       2010-06-10 4:10:55
Message-ID: AANLkTilMEFef1CF5uYpNBddPRDfwfiNyQK0UqaiD8Gq_ () mail ! gmail ! com
[Download RAW message or body]

Hello Andrew,

On Tue, Jun 8, 2010 at 5:41 PM, Andrew Klossner
<[email protected]> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic