fix possible crash on user deletion
[srvx.git] / src / mail-smtp.c
index 85b68d9f2be9b53147e637b502f046deb4fd4250..b1b50955dc294296327b801b51b2ac4178e3ae6c 100644 (file)
@@ -79,7 +79,7 @@ static struct {
     int enabled;
 } smtp_conf;
 
-DEFINE_LIST(mail_queue, struct pending_mail *);
+DEFINE_LIST(mail_queue, struct pending_mail *)
 
 static void mail_println(const char *fmt, ...)
 {
@@ -138,7 +138,7 @@ static void smtp_fill_name(char *namebuf, size_t buflen)
     }
     res = getnameinfo(sa, sa_len, namebuf, buflen, NULL, 0, NI_NUMERICHOST);
     if (res != 0) {
-        log_module(MAIL_LOG, LOG_ERROR, "Unable to get text form of socket name: %s", strerror(errno));
+        log_module(MAIL_LOG, LOG_ERROR, "Unable to get text form of socket name: %s", gai_strerror(res));
     }
 }
 
@@ -383,6 +383,7 @@ static void mail_destroyed(struct io_fd *fd)
     assert(smtp_fd == fd);
     smtp_state = CLOSED;
     smtp_fd = NULL;
+    (void)fd; /* in case NDEBUG causes assert() to be empty */
 }
 
 static void mail_connected(struct io_fd *fd, int error)