7 /* sanitize socketpair() error returns
9 /* #include <sane_socketpair.h>
11 /* int sane_socketpair(domain, type, protocol, result)
17 /* sane_socketpair() implements the socketpair(2) socket call, and
18 /* skips over silly error results such as EINTR.
20 /* Bizarre systems may have other harmless error results. Such
21 /* systems encourage programmers to ignore error results, and
22 /* penalize programmers who code defensively.
26 /* The Secure Mailer license must be distributed with this software.
29 /* IBM T.J. Watson Research
31 /* Yorktown Heights, NY 10598, USA
37 #include <sys/socket.h>
41 /* Utility library. */
44 #include "sane_socketpair.h"
46 /* sane_socketpair - sanitize socketpair() error returns */
48 int sane_socketpair(int domain
, int type
, int protocol
, int *result
)
50 static int socketpair_ok_errors
[] = {
59 * Solaris socketpair() can fail with EINTR.
61 while ((ret
= socketpair(domain
, type
, protocol
, result
)) < 0) {
62 for (count
= 0; /* void */ ; count
++) {
63 if ((err
= socketpair_ok_errors
[count
]) == 0)
66 msg_warn("socketpair: %m (trying again)");