skip failed chown check on file before writing
[hcoop/debian/exim4.git] / debian / patches / 50-relax-appendfile-chown-openafs.patch
index ba0b272..951a93d 100644 (file)
      }
  
    #endif  /* SUPPORT_MAILDIR */
+@@ -2739,12 +2750,21 @@
+   /* In all cases of writing to a new file, ensure that the file which is
+   going to be renamed has the correct ownership and mode. */
+-  if(Uchown(filename, uid, gid) || Uchmod(filename, mode))
++  /* Ignore failed chown if check_owner is disabled. */
++  if(Uchown(filename, uid, gid) && ob->check_owner)
+     {
+-    addr->basic_errno = errno;
+-    addr->message = string_sprintf("while setting perms on file %s",
+-      filename);
+-    return FALSE;
++      addr->basic_errno = errno;
++      addr->message = string_sprintf("while setting owner on file before write %s",
++                                   filename);
++      return FALSE;
++    }
++  
++  if(Uchmod(filename, mode))
++    {
++      addr->basic_errno = errno;
++      addr->message = string_sprintf("while setting chmod on file before write %s",
++                                   filename);
++      return FALSE;
+     }
+   }