Copyright year bumps for substantive changes 2017
[users/heiko/exim.git] / src / src / transports / queuefile.c
index 25747b3ab9cb2411a1b69cec5b7ec7f9fdc0d3eb..4a74c752acd9c6d92874089ee4902dc5b282fee1 100644 (file)
@@ -4,6 +4,7 @@
 
 /* Copyright (c) Andrew Colin Kissa <andrew@topdog.za.net> 2016 */
 /* Copyright (c) University of Cambridge 2016 */
+/* Copyright (c) The Exim Maintainers 2017 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 
@@ -20,12 +21,25 @@ optionlist queuefile_transport_options[] = {
     (void *)offsetof(queuefile_transport_options_block, dirname) },
 };
 
+
 /* Size of the options list. An extern variable has to be used so that its
 address can appear in the tables drtables.c. */
 
 int queuefile_transport_options_count =
   sizeof(queuefile_transport_options) / sizeof(optionlist);
 
+
+#ifdef MACRO_PREDEF
+
+/* Dummy values */
+queuefile_transport_options_block queuefile_transport_option_defaults = {0};
+void queuefile_transport_init(transport_instance *tblock) {}
+BOOL queuefile_transport_entry(transport_instance *tblock, address_item *addr) {return FALSE;}
+
+#else   /*!MACRO_PREDEF*/
+
+
+
 /* Default private options block for the appendfile transport. */
 
 queuefile_transport_options_block queuefile_transport_option_defaults = {
@@ -116,29 +130,29 @@ if (link_file)
   op = US"linking";
   s = dstpath;
   }
+else                                   /* use data copy */
+  {
+  DEBUG(D_transport) debug_printf("%s transport, copying %s => %s\n",
+    tb->name, srcpath, dstpath);
 
-/* use data copy */
-
-DEBUG(D_transport) debug_printf("%s transport, copying %s => %s\n",
-  tb->name, srcpath, dstpath);
+  if (  (s = dstpath,
+        (dstfd = openat(ddfd, CCS filename, O_RDWR|O_CREAT|O_EXCL, SPOOL_MODE))
+        < 0
+       )
+     ||    is_hdr_file
+       && (s = srcpath, (srcfd = openat(sdfd, CCS filename, O_RDONLY)) < 0)
+     )
+    op = US"opening";
 
-if (  (s = dstpath,
-       (dstfd = openat(ddfd, CCS filename, O_RDWR|O_CREAT|O_EXCL, SPOOL_MODE))
-       < 0
-      )
-   ||    is_hdr_file
-      && (s = srcpath, (srcfd = openat(sdfd, CCS filename, O_RDONLY)) < 0)
-   )
-  op = US"opening";
-
-else
-  if (s = dstpath, fchmod(dstfd, SPOOL_MODE) != 0)
-    op = US"setting perms on";
   else
-    if (!copy_spool_file(dstfd, srcfd))
-      op = US"creating";
+    if (s = dstpath, fchmod(dstfd, SPOOL_MODE) != 0)
+      op = US"setting perms on";
     else
-      return TRUE;
+      if (!copy_spool_file(dstfd, srcfd))
+       op = US"creating";
+      else
+       return TRUE;
+  }
 
 addr->basic_errno = errno;
 addr->message = string_sprintf("%s transport %s file: %s failed with error: %s",
@@ -254,3 +268,5 @@ if (sdfd >= 0) (void) close(sdfd);
 put in the first address of a batch. */
 return FALSE;
 }
+
+#endif /*!MACRO_PREDEF*/