mirror of
https://github.com/QingdaoU/Judger.git
synced 2024-12-27 23:41:42 +00:00
fix multi bugs
- wrong function return type in Python binding - wrong argument number in logger.h - add unlimit value check for stack size limit
This commit is contained in:
parent
fa2ea94eb6
commit
64eeead91e
@ -100,7 +100,7 @@ static PyObject *judger_run(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
}
|
||||
|
||||
void *handler = dlopen("/usr/lib/judger/libjudger.so", RTLD_LAZY);
|
||||
int (*judger_run)(struct config *, struct result *);
|
||||
void (*judger_run)(struct config *, struct result *);
|
||||
|
||||
if (!handler) {
|
||||
RaiseValueError("dlopen error")
|
||||
|
10
src/child.c
10
src/child.c
@ -39,10 +39,12 @@ void close_file(FILE *fp, ...) {
|
||||
int child_process(FILE *log_fp, struct config *_config) {
|
||||
FILE *input_file = NULL, *output_file = NULL, *error_file = NULL;
|
||||
|
||||
struct rlimit max_stack;
|
||||
max_stack.rlim_cur = max_stack.rlim_max = (rlim_t) (_config->max_stack);
|
||||
if (setrlimit(RLIMIT_STACK, &max_stack) != 0) {
|
||||
CHILD_ERROR_EXIT(SETRLIMIT_FAILED);
|
||||
if (_config->max_stack != UNLIMITED) {
|
||||
struct rlimit max_stack;
|
||||
max_stack.rlim_cur = max_stack.rlim_max = (rlim_t) (_config->max_stack);
|
||||
if (setrlimit(RLIMIT_STACK, &max_stack) != 0) {
|
||||
CHILD_ERROR_EXIT(SETRLIMIT_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
// set memory limit
|
||||
|
@ -19,7 +19,7 @@ void log_write(int level, const char *source_filename, const int line_number, co
|
||||
#define LOG_DEBUG(log_fp, x...)
|
||||
#endif
|
||||
|
||||
#define LOG_INFO(log_fp, x...) log_write(LOG_LEVEL_INFO, __FILE__ __LINE__, log_fp, ##x)
|
||||
#define LOG_INFO(log_fp, x...) log_write(LOG_LEVEL_INFO, __FILE__, __LINE__, log_fp, ##x)
|
||||
#define LOG_WARNING(log_fp, x...) log_write(LOG_LEVEL_WARNING, __FILE__, __LINE__, log_fp, ##x)
|
||||
#define LOG_FATAL(log_fp, x...) log_write(LOG_LEVEL_FATAL, __FILE__, __LINE__, log_fp, ##x)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user