when child process calls CHILD_ERROR_EXIT, it should kill itself

This commit is contained in:
virusdefender 2017-10-14 22:53:45 +08:00
parent cc1fc4a3e2
commit e9952f428b
2 changed files with 3 additions and 4 deletions

View File

@ -36,7 +36,7 @@ void close_file(FILE *fp, ...) {
}
int child_process(FILE *log_fp, struct config *_config) {
void child_process(FILE *log_fp, struct config *_config) {
FILE *input_file = NULL, *output_file = NULL, *error_file = NULL;
if (_config->max_stack != UNLIMITED) {
@ -159,5 +159,4 @@ int child_process(FILE *log_fp, struct config *_config) {
execve(_config->exe_path, _config->args, _config->env);
CHILD_ERROR_EXIT(EXECVE_FAILED);
return 0;
}

View File

@ -9,10 +9,10 @@
LOG_FATAL(log_fp, "Error: System errno: %s; Internal errno: "#error_code, strerror(errno)); \
close_file(input_file, output_file, error_file); \
raise(SIGUSR1); \
return -1; \
exit(EXIT_FAILURE); \
}
int child_process(FILE *log_fp, struct config *_config);
void child_process(FILE *log_fp, struct config *_config);
#endif //JUDGER_CHILD_H