Logging: fix errno decodes
authorJeremy Harris <jgh146exb@wizmail.org>
Tue, 13 Sep 2016 22:49:09 +0000 (23:49 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Tue, 13 Sep 2016 23:33:48 +0000 (00:33 +0100)
src/src/log.c
src/src/transports/smtp.c

index 860b8b0a25b6e9e3eebcd3a57f74878fdf5cf25c..032eb876f205099888597450168df2fca5364145 100644 (file)
@@ -117,7 +117,7 @@ static const uschar * exim_errstrings[] = {
 const uschar *
 exim_errstr(int err)
 {
-return errno < 0 ? exim_errstrings[-err] : CUS strerror(err);
+return err < 0 ? exim_errstrings[-err] : CUS strerror(err);
 }
 
 /*************************************************
index 85582e7535523f14316e30aeb31ad7477e446caf..e8a675750dced17ec8e867bf73c410d55e5d04a7 100644 (file)
@@ -631,11 +631,11 @@ Returns:   nothing
 static void
 write_logs(address_item *addr, host_item *host)
 {
-uschar * message = string_sprintf("H=%s [%s]", host->name, host->address);
+uschar * message = LOGGING(outgoing_port)
+  ? string_sprintf("H=%s [%s]:%d", host->name, host->address,
+                   host->port == PORT_NONE ? 25 : host->port)
+  : string_sprintf("H=%s [%s]", host->name, host->address);
 
-if (LOGGING(outgoing_port))
-  message = string_sprintf("%s:%d", message,
-             host->port == PORT_NONE ? 25 : host->port);
 if (addr->message)
   {
   message = string_sprintf("%s: %s", message, addr->message);