changeset 9336:366a327b028b HEAD

master: If execv() fails with ENOMEM, mention the *_process_size setting.
author Timo Sirainen <tss@iki.fi>
date Mon, 24 Aug 2009 13:13:45 -0400
parents a366666f4b50
children 0827941c0e7c
files src/master/auth-process.c src/master/child-process.c src/master/child-process.h src/master/dict-process.c src/master/login-process.c src/master/mail-process.c src/master/ssl-init.c
diffstat 7 files changed, 6 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/master/auth-process.c	Mon Aug 17 14:18:33 2009 -0400
+++ b/src/master/auth-process.c	Mon Aug 24 13:13:45 2009 -0400
@@ -609,7 +609,6 @@
 
 	executable = group->set->executable;
 	client_process_exec(executable, "");
-	i_fatal_status(FATAL_EXEC, "execv(%s) failed: %m", executable);
 	return -1;
 }
 
@@ -675,7 +674,6 @@
 
 	executable = t_strconcat(process->group->set->executable, " -w", NULL);
 	client_process_exec(executable, "");
-	i_fatal_status(FATAL_EXEC, "execv(%s) failed: %m", executable);
 	return -1;
 }
 
--- a/src/master/child-process.c	Mon Aug 17 14:18:33 2009 -0400
+++ b/src/master/child-process.c	Mon Aug 24 13:13:45 2009 -0400
@@ -87,7 +87,9 @@
 	p = strrchr(argv[0], '/');
 	if (p != NULL) argv[0] = p+1;
 
-	execv(executable, (char **)argv);
+	(void)execv(executable, (char **)argv);
+	i_fatal_status(errno == ENOMEM ? FATAL_OUTOFMEM : FATAL_EXEC,
+		       "execv(%s) failed: %m", executable);
 }
 
 static const char *get_exit_status_message(enum fatal_exit_status status,
--- a/src/master/child-process.h	Mon Aug 17 14:18:33 2009 -0400
+++ b/src/master/child-process.h	Mon Aug 24 13:13:45 2009 -0400
@@ -33,8 +33,9 @@
 void child_process_remove(pid_t pid);
 
 void child_process_init_env(void);
-void client_process_exec(const char *cmd, const char *title);
-void client_process_exec_argv(const char *executable, const char **argv);
+void client_process_exec(const char *cmd, const char *title) ATTR_NORETURN;
+void client_process_exec_argv(const char *executable,
+			      const char **argv) ATTR_NORETURN;
 
 void child_process_set_destroy_callback(enum process_type type,
 					child_process_destroy_callback_t *cb);
--- a/src/master/dict-process.c	Mon Aug 17 14:18:33 2009 -0400
+++ b/src/master/dict-process.c	Mon Aug 24 13:13:45 2009 -0400
@@ -118,7 +118,6 @@
 
 	executable = PKG_LIBEXECDIR"/dict";
 	client_process_exec(executable, "");
-	i_fatal_status(FATAL_EXEC, "execv(%s) failed: %m", executable);
 	return -1;
 }
 
--- a/src/master/login-process.c	Mon Aug 17 14:18:33 2009 -0400
+++ b/src/master/login-process.c	Mon Aug 24 13:13:45 2009 -0400
@@ -729,8 +729,6 @@
 	restrict_process_size(group->set->login_process_size, (unsigned int)-1);
 
 	client_process_exec(group->set->login_executable, "");
-	i_fatal_status(FATAL_EXEC, "execv(%s) failed: %m",
-		       group->set->login_executable);
 	return -1;
 }
 
--- a/src/master/mail-process.c	Mon Aug 17 14:18:33 2009 -0400
+++ b/src/master/mail-process.c	Mon Aug 24 13:13:45 2009 -0400
@@ -524,8 +524,6 @@
 		client_process_exec(executable, "");
 	else
 		client_process_exec_argv(executable, args);
-
-	i_fatal_status(FATAL_EXEC, "execv(%s) failed: %m", executable);
 }
 
 static void nfs_warn_if_found(const char *mail, const char *full_home_dir)
@@ -937,8 +935,6 @@
 	}
 
 	client_process_exec(set->mail_executable, title);
-	i_fatal_status(FATAL_EXEC, "execv(%s) failed: %m",
-		       set->mail_executable);
 
 	/* not reached */
 	return MASTER_LOGIN_STATUS_INTERNAL_ERROR;
--- a/src/master/ssl-init.c	Mon Aug 17 14:18:33 2009 -0400
+++ b/src/master/ssl-init.c	Mon Aug 24 13:13:45 2009 -0400
@@ -63,7 +63,6 @@
 	child_process_init_env();
 	client_process_exec(t_strconcat(binpath, " "SSL_PARAMETERS_PERM_PATH,
 					NULL), "");
-	i_fatal_status(FATAL_EXEC, "execv(%s) failed: %m", binpath);
 }
 
 static void