fixed ticket #12 reported bugs

This commit is contained in:
roberto@maverick64
2011-07-03 19:08:22 +02:00
parent e9726b1e75
commit 545784d7af
3 changed files with 14 additions and 8 deletions
+5
View File
@@ -6,6 +6,7 @@ extern struct uwsgi_server uwsgi;
extern char **environ;
int emperor_queue;
char *emperor_absolute_dir;
static void royal_death(int signum) {
uwsgi_notify("The Emperor is buried.");
@@ -331,6 +332,9 @@ void emperor_add(char *name, time_t born, char *config, uint32_t config_size) {
if (uwsgi.vassals_start_hook) {
uwsgi_log("running vassal start-hook: %s %s\n", uwsgi.vassals_start_hook, n_ui->name);
if (setenv("UWSGI_VASSALS_DIR", emperor_absolute_dir, 1)) {
uwsgi_error("setenv()");
}
int start_hook_ret = uwsgi_run_command_and_wait(uwsgi.vassals_start_hook, n_ui->name);
uwsgi_log("%s start-hook returned %d\n", n_ui->name, start_hook_ret);
}
@@ -434,6 +438,7 @@ reconnect:
uwsgi_error("glob()");
exit(1);
}
emperor_absolute_dir = realpath(".", NULL);
}
ui = &ui_base;
+8 -7
View File
@@ -2311,10 +2311,9 @@ void uwsgi_sig_pause() {
sigsuspend(&mask);
}
int uwsgi_run_command_and_wait(char *command, ...) {
va_list ap;
int uwsgi_run_command_and_wait(char *command, char *arg) {
char *argv[3];
int waitpid_status = 0;
pid_t pid = fork();
if (pid < 0) {
@@ -2330,11 +2329,13 @@ int uwsgi_run_command_and_wait(char *command, ...) {
return WEXITSTATUS(waitpid_status);
}
va_start(ap, command);
execlp(command, command, ap, (char *) NULL);
va_end(ap);
argv[0] = command;
argv[1] = arg;
argv[2] = NULL;
uwsgi_error("execlp()");
execvp(command, argv);
uwsgi_error("execvp()");
//never here
exit(1);
}
+1 -1
View File
@@ -2048,7 +2048,7 @@ void uwsgi_set_cgroup(void);
void uwsgi_add_sockets_to_queue(int);
void uwsgi_del_sockets_from_queue(int);
int uwsgi_run_command_and_wait(char *, ...);
int uwsgi_run_command_and_wait(char *, char *);
void uwsgi_manage_signal_cron(time_t);
int uwsgi_run_command(char *);