Compiler masochism compliance.
[exim.git] / src / src / transports / tf_maildir.c
index 98862cc907e541d6d48e1a33b238b37a57f24615..e6c8bef9435e42c14a2d3f31fb1fc700e1a88715 100644 (file)
@@ -1,10 +1,10 @@
-/* $Cambridge: exim/src/src/transports/tf_maildir.c,v 1.12 2009/10/19 12:42:13 nm4 Exp $ */
+/* $Cambridge: exim/src/src/transports/tf_maildir.c,v 1.14 2009/11/16 19:56:54 nm4 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) University of Cambridge 1995 - 2007 */
+/* Copyright (c) University of Cambridge 1995 - 2009 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 /* Functions in support of the use of maildirsize files for handling quotas in
@@ -48,7 +48,7 @@ BOOL maildir_ensure_directories(uschar *path, address_item *addr,
 {
 int i;
 struct stat statbuf;
-char *subdirs[] = { "/tmp", "/new", "/cur" };
+const char *subdirs[] = { "/tmp", "/new", "/cur" };
 
 DEBUG(D_transport)
   debug_printf("ensuring maildir directories exist in %s\n", path);
@@ -62,16 +62,16 @@ loop so that code can be shared. */
 for (i = 0; i < 4; i++)
   {
   int j;
-  uschar *dir, *mdir;
+  const uschar *dir, *mdir;
 
   if (i == 0)
     {
-    mdir = US"";
+    mdir = CUS"";
     dir = path;
     }
   else
     {
-    mdir = US subdirs[i-1];
+    mdir = CUS subdirs[i-1];
     dir = mdir + 1;
     }
 
@@ -559,7 +559,7 @@ else
   tempname = string_sprintf("%s/tmp/%lu.H%luP%lu.%s", path, tv.tv_sec,
     tv.tv_usec, getpid(), primary_hostname);
 
-  fd = Uopen(tempname, O_RDWR|O_CREAT|O_EXCL, 0600);
+  fd = Uopen(tempname, O_RDWR|O_CREAT|O_EXCL, ob->mode ? ob->mode : 0600);
   if (fd >= 0)
     {
     (void)sprintf(CS buffer, OFF_T_FMT "S,%dC\n" OFF_T_FMT " %d\n",
@@ -584,7 +584,7 @@ else
       "a later subdirectory modification\n");
     (void)Uunlink(filename);
     (void)close(fd);
-    fd = -1;
+    fd = -2;
     }
   }