Commit 39f1b8e7 authored by Simon Kelley's avatar Simon Kelley

Better logging of socket-creation errors.

parent af576b56
...@@ -347,6 +347,7 @@ static int make_sock(union mysockaddr *addr, int type, int dienow) ...@@ -347,6 +347,7 @@ static int make_sock(union mysockaddr *addr, int type, int dienow)
if ((fd = socket(family, type, 0)) == -1) if ((fd = socket(family, type, 0)) == -1)
{ {
int port; int port;
char *s;
/* No error if the kernel just doesn't support this IP flavour */ /* No error if the kernel just doesn't support this IP flavour */
if (errno == EPROTONOSUPPORT || if (errno == EPROTONOSUPPORT ||
...@@ -355,15 +356,15 @@ static int make_sock(union mysockaddr *addr, int type, int dienow) ...@@ -355,15 +356,15 @@ static int make_sock(union mysockaddr *addr, int type, int dienow)
return -1; return -1;
err: err:
port = prettyprint_addr(addr, daemon->addrbuff);
if (!option_bool(OPT_NOWILD) && !option_bool(OPT_CLEVERBIND))
sprintf(daemon->addrbuff, "port %d", port);
s = _("failed to create listening socket for %s: %s");
if (dienow) if (dienow)
{ die(s, daemon->addrbuff, EC_BADNET);
port = prettyprint_addr(addr, daemon->namebuff);
if (!option_bool(OPT_NOWILD)) my_syslog(LOG_ERR, s, daemon->addrbuff, strerror(errno));
sprintf(daemon->namebuff, "port %d", port);
die(_("failed to create listening socket for %s: %s"),
daemon->namebuff, EC_BADNET);
}
return -1; return -1;
} }
......
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