Commit 287fd150 authored by Phil Blundell's avatar Phil Blundell

Only update sfd when we successfully open a

socket. Based (loosely) on a patch from
"Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
parent 8e304247
...@@ -46,8 +46,9 @@ int sockets_open(int family) ...@@ -46,8 +46,9 @@ int sockets_open(int family)
if (access(af->flag_file, R_OK)) if (access(af->flag_file, R_OK))
continue; continue;
} }
sfd = socket(af->af, SOCK_DGRAM, 0); af->fd = socket(af->af, SOCK_DGRAM, 0);
af->fd = sfd; if (af->fd >= 0)
sfd = af->fd;
} }
if (sfd < 0) if (sfd < 0)
fprintf(stderr, _("No usable address families found.\n")); fprintf(stderr, _("No usable address families found.\n"));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment