1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-18 02:19:39 +00:00

Fix socket calls on error post-r243965.

Submitted by:	Garrett Cooper
This commit is contained in:
Kevin Lo 2012-12-21 15:54:13 +00:00
parent a443a16906
commit a5752d55e0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=244538
9 changed files with 12 additions and 12 deletions

View File

@ -85,7 +85,7 @@ netsettime(time_t tval)
dest.sin_addr.s_addr = htonl((u_long)INADDR_ANY);
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s < 0) {
if (errno != EPROTONOSUPPORT)
if (errno != EAFNOSUPPORT)
warn("timed");
return (retval = 2);
}

View File

@ -71,10 +71,10 @@ NgMkSockNode(const char *name, int *csp, int *dsp)
name = NULL;
/* Create control socket; this also creates the netgraph node.
If we get an EPROTONOSUPPORT then the socket node type is
If we get an EAFNOSUPPORT then the socket node type is
not loaded, so load it and try again. */
if ((cs = socket(AF_NETGRAPH, SOCK_DGRAM, NG_CONTROL)) < 0) {
if (errno == EPROTONOSUPPORT) {
if (errno == EAFNOSUPPORT) {
if (kldload(NG_SOCKET_KLD) < 0) {
errnosv = errno;
if (_gNgDebugLevel >= 1)

View File

@ -769,7 +769,7 @@ family_supported(int family)
int sock;
sock = socket(family, SOCK_STREAM, 0);
if (sock == -1 && errno == EPROTONOSUPPORT)
if (sock == -1 && errno == EAFNOSUPPORT)
return (false);
if (sock >= 0)
(void)close(sock);

View File

@ -148,7 +148,7 @@ nd6_status(int s)
memset(&nd, 0, sizeof(nd));
strncpy(nd.ifname, ifr.ifr_name, sizeof(nd.ifname));
if ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
if (errno != EPROTONOSUPPORT)
if (errno != EAFNOSUPPORT)
warn("socket(AF_INET6, SOCK_DGRAM)");
return;
}

View File

@ -520,7 +520,7 @@ ifconfig(int argc, char *const *argv, int iscreate, const struct afswtch *uafp)
AF_LOCAL : afp->af_af;
if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0 &&
(uafp != NULL || errno != EPROTONOSUPPORT ||
(uafp != NULL || errno != EAFNOSUPPORT ||
(s = socket(AF_LOCAL, SOCK_DGRAM, 0)) < 0))
err(1, "socket(family %u,SOCK_DGRAM", ifr.ifr_addr.sa_family);

View File

@ -649,7 +649,7 @@ create_service(struct netconfig *nconf)
*/
if ((fd = __rpc_nconf2fd(nconf)) < 0) {
int non_fatal = 0;
if (errno == EPROTONOSUPPORT &&
if (errno == EAFNOSUPPORT &&
nconf->nc_semantics != NC_TPI_CLTS)
non_fatal = 1;

View File

@ -204,12 +204,12 @@ main(int argc, char **argv)
s6 = -1;
#ifdef INET
s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (s == -1 && errno != EPROTONOSUPPORT)
if (s == -1 && errno != EAFNOSUPPORT)
err(1, "can't open IPv4 socket");
#endif
#ifdef INET6
s6 = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
if (s6 == -1 && errno != EPROTONOSUPPORT)
if (s6 == -1 && errno != EAFNOSUPPORT)
err(1, "can't open IPv6 socket");
#endif
if (s == -1 && s6 == -1)

View File

@ -289,7 +289,7 @@ init_transport(struct netconfig *nconf)
*/
if ((fd = __rpc_nconf2fd(nconf)) < 0) {
int non_fatal = 0;
if (errno == EPROTONOSUPPORT)
if (errno == EAFNOSUPPORT)
non_fatal = 1;
syslog(non_fatal?LOG_DEBUG:LOG_ERR, "cannot create socket for %s",
nconf->nc_netid);
@ -352,7 +352,7 @@ init_transport(struct netconfig *nconf)
*/
if ((fd = __rpc_nconf2fd(nconf)) < 0) {
int non_fatal = 0;
if (errno == EPROTONOSUPPORT &&
if (errno == EAFNOSUPPORT &&
nconf->nc_semantics != NC_TPI_CLTS)
non_fatal = 1;
syslog(non_fatal ? LOG_DEBUG : LOG_ERR,

View File

@ -292,7 +292,7 @@ create_service(const int sock, const struct netconfig *nconf,
s = __rpc_nconf2fd(nconf);
if (s < 0) {
if (errno == EPROTONOSUPPORT)
if (errno == EAFNOSUPPORT)
_msgout("unsupported"
" transport: %s",
nconf->nc_netid);