Fix unsigned < 0 check
[exim.git] / src / src / deliver.c
index 3f5800ded2b9c3b34c72ec7a7e283f580d0da4bb..d30b3940202323df39168275926cd214cb88c7a1 100644 (file)
@@ -863,16 +863,12 @@ if (log_extra_selector & LX_smtp_confirmation &&
 /* Time on queue and actual time taken to deliver */
 
 if ((log_extra_selector & LX_queue_time) != 0)
-  {
   s = string_append(s, &size, &ptr, 2, US" QT=",
-    readconf_printtime(time(NULL) - received_time));
-  }
+    readconf_printtime( (int) ((long)time(NULL) - (long)received_time)) );
 
 if ((log_extra_selector & LX_deliver_time) != 0)
-  {
   s = string_append(s, &size, &ptr, 2, US" DT=",
     readconf_printtime(addr->more_errno));
-  }
 
 /* string_cat() always leaves room for the terminator. Release the
 store we used to build the line after writing it. */
@@ -6497,7 +6493,8 @@ if (addr_senddsn != NULL)
     DEBUG(D_deliver) debug_printf("sending error message to: %s\n", sender_address);
   
     /* build unique id for MIME boundary */
-    snprintf(boundaryStr, 63, "%d-eximdsn-%d", time(NULL), rand());      
+    snprintf(boundaryStr, sizeof(boundaryStr)-1, TIME_T_FMT "-eximdsn-%d",
+      time(NULL), rand());
     DEBUG(D_deliver) debug_printf("DSN: MIME boundary: %s\n", boundaryStr);
   
     if (errors_reply_to != NULL) fprintf(f,"Reply-To: %s\n", errors_reply_to);
@@ -6699,6 +6696,12 @@ while (addr_failed != NULL)
       BOOL to_sender = strcmpic(sender_address, bounce_recipient) == 0;
       int max = (bounce_return_size_limit/DELIVER_IN_BUFFER_SIZE + 1) *
         DELIVER_IN_BUFFER_SIZE;
+#ifdef EXPERIMENTAL_DSN
+      uschar boundaryStr[64];
+      uschar *dsnlimitmsg;
+      uschar *dsnnotifyhdr;
+      int topt;
+#endif
 
       DEBUG(D_deliver)
         debug_printf("sending error message to: %s\n", bounce_recipient);
@@ -6754,8 +6757,7 @@ while (addr_failed != NULL)
 
 #ifdef EXPERIMENTAL_DSN
       /* generate boundary string and output MIME-Headers */
-      uschar boundaryStr[64];
-      snprintf(boundaryStr, 63, "%d-eximdsn-%d", time(NULL), rand());
+      snprintf(boundaryStr, 63, "%l-eximdsn-%d", (long) time(NULL), rand());
       fprintf(f,"Content-Type: multipart/report; report-type=delivery-status; boundary=%s\n", boundaryStr);
       fprintf(f,"MIME-Version: 1.0\n");
 #endif
@@ -7019,9 +7021,10 @@ wording. */
   
       fprintf(f,"\n--%s\n", boundaryStr);
 
-      uschar *dsnlimitmsg = US"X-Exim-DSN-Information: Due to administrative limits only headers are returned";
-      uschar *dsnnotifyhdr = NULL;
-      int topt = topt_add_return_path;
+      dsnlimitmsg = US"X-Exim-DSN-Information: Due to administrative limits only headers are returned";
+      dsnnotifyhdr = NULL;
+      topt = topt_add_return_path;
+
       /* RET=HDRS? top priority */
       if (dsn_ret == dsn_ret_hdrs)
         topt |= topt_no_body;
@@ -7172,7 +7175,7 @@ if (addr_defer == NULL)
 
   if ((log_extra_selector & LX_queue_time_overall) != 0)
     log_write(0, LOG_MAIN, "Completed QT=%s",
-      readconf_printtime(time(NULL) - received_time));
+      readconf_printtime( (int) ((long)time(NULL) - (long)received_time)) );
   else
     log_write(0, LOG_MAIN, "Completed");
 
@@ -7363,6 +7366,9 @@ else if (addr_defer != (address_item *)(+1))
         uschar *wmf_text;
         FILE *wmf = NULL;
         FILE *f = fdopen(fd, "wb");
+#ifdef EXPERIMENTAL_DSN
+       uschar boundaryStr[64];
+#endif
 
         if (warn_message_file != NULL)
           {
@@ -7385,8 +7391,7 @@ else if (addr_defer != (address_item *)(+1))
 
 #ifdef EXPERIMENTAL_DSN
         /* generated boundary string and output MIME-Headers */
-        uschar boundaryStr[64];
-        snprintf(boundaryStr, 63, "%d-eximdsn-%d", time(NULL), rand());
+        snprintf(boundaryStr, 63, "%l-eximdsn-%d", (long) time(NULL), rand());
         fprintf(f,"Content-Type: multipart/report; report-type=delivery-status; boundary=%s\n", boundaryStr);
         fprintf(f,"MIME-Version: 1.0\n");
 #endif