changeset 4216:9f8493a8cd65 HEAD

NFS check should be done only once at startup, not every time.
author Timo Sirainen <tss@iki.fi>
date Fri, 21 Apr 2006 18:14:44 +0300
parents e7ff0eced559
children 4d9706112af4
files src/master/mail-process.c
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/master/mail-process.c	Fri Apr 21 17:09:43 2006 +0300
+++ b/src/master/mail-process.c	Fri Apr 21 18:14:44 2006 +0300
@@ -393,7 +393,7 @@
 	array_t ARRAY_DEFINE(extra_args, const char *);
 	unsigned int i, count;
 	int err, ret, log_fd, nice;
-	bool home_given;
+	bool home_given, nfs_check;
 
 	// FIXME: per-group
 	if (mail_process_count == set->max_mail_processes) {
@@ -459,6 +459,15 @@
 		fd_close_on_exec(log_fd, TRUE);
 	}
 
+	/* See if we need to do the initial NFS check. We want to do this only
+	   once, so the check code needs to be before fork(). */
+	if (set->nfs_check && !set->mmap_disable && !dump_capability) {
+		set->nfs_check = FALSE;
+		nfs_check = TRUE;
+	} else {
+		nfs_check = FALSE;
+	}
+
 	pid = fork();
 	if (pid < 0) {
 		i_error("fork() failed: %m");
@@ -564,7 +573,7 @@
 
         mail_process_set_environment(set, mail, var_expand_table);
 
-	/* add extra args. uppercase key value. */
+	extra args. uppercase key value. */
 	args = array_get(&extra_args, &count);
 	for (i = 0; i < count; i++) {
 		if (*args[i] == '=') {
@@ -584,11 +593,8 @@
 		}
 	}
 
-	if (set->nfs_check && !set->mmap_disable && !dump_capability) {
-		/* do this only once */
+	if (nfs_check)
 		nfs_warn_if_found(getenv("MAIL"), home_dir);
-		set->nfs_check = FALSE;
-	}
 
 	env_put("LOGGED_IN=1");
 	env_put(t_strconcat("HOME=", home_dir, NULL));