| 25 | /* sane_socketpair - sanitize socketpair() error returns */ |
| 26 | |
| 27 | int acl_sane_socketpair(int domain, int type, int protocol, ACL_SOCKET result[2]) |
| 28 | { |
| 29 | static int socketpair_ok_errors[] = { |
| 30 | EINTR, |
| 31 | 0, |
| 32 | }; |
| 33 | int count; |
| 34 | int err; |
| 35 | int ret; |
| 36 | |
| 37 | /* |
| 38 | * Solaris socketpair() can fail with EINTR. |
| 39 | */ |
| 40 | while ((ret = socketpair(domain, type, protocol, result)) < 0) { |
| 41 | for (count = 0; /* void */ ; count++) { |
| 42 | if ((err = socketpair_ok_errors[count]) == 0) { |
| 43 | return (ret); |
| 44 | } |
| 45 | if (acl_last_error() == err) { |
| 46 | acl_msg_warn("socketpair: %s (trying again)", |
| 47 | acl_last_serror()); |
| 48 | sleep(1); |
| 49 | break; |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | return ret; |
| 54 | } |
| 55 | |
| 56 | #elif defined(ACL_WINDOWS) |
| 57 |
no test coverage detected
searching dependent graphs…