Mailing List Archive

[6876] cherokee/trunk/cherokee: Neither 'cherokee' nor 'cherokee-worker' returned a error on the
Revision: 6876
http://svn.cherokee-project.com/changeset/6876
Author: alo
Date: 2011-10-01 11:27:39 +0200 (Sat, 01 Oct 2011)
Log Message:
-----------
Neither 'cherokee' nor 'cherokee-worker' returned a error on the
process retcode when the initialization failed.

Modified Paths:
--------------
cherokee/trunk/cherokee/macros.h
cherokee/trunk/cherokee/main.c
cherokee/trunk/cherokee/main_worker.c

Modified: cherokee/trunk/cherokee/macros.h
===================================================================
--- cherokee/trunk/cherokee/macros.h 2011-10-01 09:27:35 UTC (rev 6875)
+++ cherokee/trunk/cherokee/macros.h 2011-10-01 09:27:39 UTC (rev 6876)
@@ -115,9 +115,10 @@
#define FD_NUM_MIN_PER_THREAD 8 /* range: 8 ... 65000 */
#define FD_NUM_CUSTOM_LIMIT 4096 /* range: 16 ... 65000 */

-#define EXIT_OK 0
-#define EXIT_ERROR 1
-#define EXIT_OK_ONCE 2
+#define EXIT_OK 0
+#define EXIT_ERROR 1
+#define EXIT_OK_ONCE 2
+#define EXIT_ERROR_FATAL 3

#if (FD_NUM_MIN_SYSTEM < 16)
# error FD_NUM_MIN_SYSTEM too low, < 16

Modified: cherokee/trunk/cherokee/main.c
===================================================================
--- cherokee/trunk/cherokee/main.c 2011-10-01 09:27:35 UTC (rev 6875)
+++ cherokee/trunk/cherokee/main.c 2011-10-01 09:27:39 UTC (rev 6876)
@@ -875,6 +875,10 @@
if (re == EXIT_OK_ONCE) {
clean_up();
exit (EXIT_OK);
+
+ } else if (re == EXIT_ERROR_FATAL) {
+ clean_up();
+ exit (EXIT_ERROR);
}

/* Child terminated normally */

Modified: cherokee/trunk/cherokee/main_worker.c
===================================================================
--- cherokee/trunk/cherokee/main_worker.c 2011-10-01 09:27:35 UTC (rev 6875)
+++ cherokee/trunk/cherokee/main_worker.c 2011-10-01 09:27:39 UTC (rev 6876)
@@ -361,11 +361,14 @@
cherokee_init();

ret = cherokee_server_new (&srv);
- if (ret < ret_ok) return 1;
+ if (ret < ret_ok) {
+ exit (EXIT_ERROR_FATAL);
+ }

ret = process_parameters (argc, argv);
- if (ret != ret_ok)
- exit (EXIT_OK_ONCE);
+ if (ret != ret_ok) {
+ exit (EXIT_ERROR_FATAL);
+ }

if (print_modules) {
cherokee_info_build_print (srv);
@@ -374,13 +377,16 @@

if (just_test) {
ret = test_configuration_file();
- if (ret != ret_ok)
- exit(EXIT_ERROR);
+ if (ret != ret_ok) {
+ exit (EXIT_ERROR);
+ }
exit (EXIT_OK_ONCE);
}

ret = common_server_initialization (srv);
- if (ret < ret_ok) return 2;
+ if (ret < ret_ok) {
+ exit (EXIT_ERROR_FATAL);
+ }

do {
ret = cherokee_server_step (srv);
@@ -391,5 +397,6 @@

free (config_file);
cherokee_mrproper();
+
return EXIT_OK;
}