Skip to content

Commit

Permalink
Neither 'cherokee' nor 'cherokee-worker' returned a error on the
Browse files Browse the repository at this point in the history
process retcode when the initialization failed.

git-svn-id: svn://cherokee-project.com/cherokee/trunk@6876 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information
alobbs committed Oct 1, 2011
1 parent 030c268 commit 2c8bc6f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
7 changes: 4 additions & 3 deletions cherokee/macros.h
Expand Up @@ -115,9 +115,10 @@
#define FD_NUM_MIN_PER_THREAD 8 /* range: 8 ... 65000 */ #define FD_NUM_MIN_PER_THREAD 8 /* range: 8 ... 65000 */
#define FD_NUM_CUSTOM_LIMIT 4096 /* range: 16 ... 65000 */ #define FD_NUM_CUSTOM_LIMIT 4096 /* range: 16 ... 65000 */


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


#if (FD_NUM_MIN_SYSTEM < 16) #if (FD_NUM_MIN_SYSTEM < 16)
# error FD_NUM_MIN_SYSTEM too low, < 16 # error FD_NUM_MIN_SYSTEM too low, < 16
Expand Down
4 changes: 4 additions & 0 deletions cherokee/main.c
Expand Up @@ -875,6 +875,10 @@ process_wait (pid_t pid)
if (re == EXIT_OK_ONCE) { if (re == EXIT_OK_ONCE) {
clean_up(); clean_up();
exit (EXIT_OK); exit (EXIT_OK);

} else if (re == EXIT_ERROR_FATAL) {
clean_up();
exit (EXIT_ERROR);
} }


/* Child terminated normally */ /* Child terminated normally */
Expand Down
19 changes: 13 additions & 6 deletions cherokee/main_worker.c
Expand Up @@ -361,11 +361,14 @@ main (int argc, char **argv)
cherokee_init(); cherokee_init();


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


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


if (print_modules) { if (print_modules) {
cherokee_info_build_print (srv); cherokee_info_build_print (srv);
Expand All @@ -374,13 +377,16 @@ main (int argc, char **argv)


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


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


do { do {
ret = cherokee_server_step (srv); ret = cherokee_server_step (srv);
Expand All @@ -391,5 +397,6 @@ main (int argc, char **argv)


free (config_file); free (config_file);
cherokee_mrproper(); cherokee_mrproper();

return EXIT_OK; return EXIT_OK;
} }

0 comments on commit 2c8bc6f

Please sign in to comment.