Skip to content

Commit 8caf3ac

Browse files
committed
-nst command line option added to disable stack traces
1 parent 45fdd23 commit 8caf3ac

File tree

6 files changed

+43
-0
lines changed

6 files changed

+43
-0
lines changed

bin/ej-compile.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,7 @@ main(int argc, char *argv[])
15281528
int parallel_mode = 0;
15291529
int ejudge_xml_fd = -1;
15301530
int stderr_fd = -1;
1531+
int disable_stack_trace = 0;
15311532

15321533
#if HAVE_SETSID - 0
15331534
path_t log_path;
@@ -1671,6 +1672,10 @@ main(int argc, char *argv[])
16711672
verbose_mode = 1;
16721673
++i;
16731674
argv_restart[j++] = "-v";
1675+
} else if (!strcmp(argv[i], "-nst")) {
1676+
disable_stack_trace = 1;
1677+
++i;
1678+
argv_restart[j++] = argv[i];
16741679
} else if (!strcmp(argv[i], "--help")) {
16751680
code = 0;
16761681
goto print_usage;
@@ -1684,6 +1689,9 @@ main(int argc, char *argv[])
16841689
if (i < argc) goto print_usage;
16851690
argv_restart[j] = 0;
16861691
start_set_args(argv_restart);
1692+
if (disable_stack_trace <= 0) {
1693+
start_enable_stacktrace(NULL);
1694+
}
16871695

16881696
if (!compile_server_id || !*compile_server_id) {
16891697
xfree(compile_server_id); compile_server_id = NULL;

bin/ej-contests.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,7 @@ main(int argc, char *argv[])
916916
char **argv_restart = 0;
917917
int pid;
918918
time_t server_start_time = 0;
919+
int disable_stack_trace = 0;
919920

920921
hr_set_symbolic_action_table(NEW_SRV_ACTION_LAST, ns_symbolic_action_table, ns_submit_button_labels, 0);
921922
time(&server_start_time);
@@ -948,6 +949,9 @@ main(int argc, char *argv[])
948949
} else if (!strcmp(argv[i], "-R")) {
949950
params.restart_mode_flag = 1;
950951
++i;
952+
} else if (!strcmp(argv[i], "-nst")) {
953+
disable_stack_trace = 1;
954+
++i;
951955
} else if (!strcmp(argv[i], "--")) {
952956
argv_restart[j++] = argv[i];
953957
i++;
@@ -965,6 +969,9 @@ main(int argc, char *argv[])
965969
if (i != argc) startup_error("invalid number of parameters");
966970
argv_restart[j] = 0;
967971
start_set_args(argv_restart);
972+
if (disable_stack_trace <= 0) {
973+
start_enable_stacktrace(NULL);
974+
}
968975

969976
if (!(pid = start_find_process("ej-contests", NULL, 0))) {
970977
params.force_socket_flag = 1;

bin/ej-jobs.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,11 +1817,15 @@ int main(int argc, char *argv[])
18171817
const unsigned char *group = NULL;
18181818
const unsigned char *workdir = NULL;
18191819
unsigned char *ejudge_xml_path = NULL;
1820+
int disable_stack_trace = 0;
18201821

18211822
while (cur_arg < argc) {
18221823
if (!strcmp(argv[cur_arg], "-D")) {
18231824
as.daemon_mode = 1;
18241825
cur_arg++;
1826+
} else if (!strcmp(argv[cur_arg], "-nst")) {
1827+
disable_stack_trace = 1;
1828+
cur_arg++;
18251829
} else if (!strcmp(argv[cur_arg], "-R")) {
18261830
restart_mode = 1;
18271831
cur_arg++;
@@ -1861,6 +1865,9 @@ int main(int argc, char *argv[])
18611865
}
18621866
argv_restart[j] = NULL;
18631867
start_set_args(argv_restart);
1868+
if (disable_stack_trace <= 0) {
1869+
start_enable_stacktrace(NULL);
1870+
}
18641871

18651872
int pid;
18661873
if ((pid = start_find_process("ej-jobs", NULL, 0)) > 0) {

bin/ej-super-run.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,6 +1357,7 @@ main(int argc, char *argv[])
13571357
const unsigned char *user = NULL, *group = NULL, *workdir = NULL;
13581358
int halt_timeout = 0, halt_requested = 0;
13591359
unsigned char *halt_command = NULL;
1360+
int disable_stack_trace = 0;
13601361

13611362
signal(SIGPIPE, SIG_IGN);
13621363

@@ -1392,6 +1393,9 @@ main(int argc, char *argv[])
13921393
} else if (!strcmp(argv[cur_arg], "-R")) {
13931394
restart_mode = 1;
13941395
++cur_arg;
1396+
} else if (!strcmp(argv[cur_arg], "-nst")) {
1397+
disable_stack_trace = 1;
1398+
++cur_arg;
13951399
} else if (!strcmp(argv[cur_arg], "-s")) {
13961400
if (cur_arg + 1 >= argc) fatal("argument expected for -s");
13971401
ignored_archs[ignored_archs_count++] = xstrdup(argv[cur_arg + 1]);
@@ -1521,6 +1525,9 @@ main(int argc, char *argv[])
15211525

15221526
argv_restart[argc_restart] = NULL;
15231527
start_set_args(argv_restart);
1528+
if (disable_stack_trace <= 0) {
1529+
start_enable_stacktrace(NULL);
1530+
}
15241531

15251532
if (halt_command) {
15261533
master_down_enabled = 1;

bin/ej-super-server.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2781,6 +2781,7 @@ main(int argc, char **argv)
27812781
const unsigned char *user = 0, *group = 0, *workdir = 0;
27822782
char **argv_restart = 0;
27832783
int pid;
2784+
int disable_stack_trace = 0;
27842785

27852786
hr_set_symbolic_action_table(SSERV_CMD_LAST, 0, 0, super_serve_help_urls);
27862787

@@ -2800,6 +2801,9 @@ main(int argc, char **argv)
28002801
} else if (!strcmp(argv[cur_arg], "-R")) {
28012802
restart_mode = 1;
28022803
cur_arg++;
2804+
} else if (!strcmp(argv[cur_arg], "-nst")) {
2805+
disable_stack_trace = 1;
2806+
cur_arg++;
28032807
} else if (!strcmp(argv[cur_arg], "-a")) {
28042808
autonomous_mode = 1;
28052809
argv_restart[j++] = argv[cur_arg];
@@ -2848,6 +2852,9 @@ main(int argc, char **argv)
28482852
}
28492853
argv_restart[j] = 0;
28502854
start_set_args(argv_restart);
2855+
if (disable_stack_trace <= 0) {
2856+
start_enable_stacktrace(NULL);
2857+
}
28512858

28522859
if (!(pid = start_find_process("ej-super-server", NULL, 0))) {
28532860
forced_mode = 1;

bin/ej-users.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12193,6 +12193,7 @@ main(int argc, char *argv[])
1219312193
const unsigned char *user = 0, *group = 0, *workdir = 0, *plugin_dir = 0;
1219412194
char **argv_restart = 0;
1219512195
int restart_mode = 0;
12196+
int disable_stack_trace = 0;
1219612197

1219712198
start_set_self_args(argc, argv);
1219812199
XCALLOC(argv_restart, argc + 2);
@@ -12205,6 +12206,9 @@ main(int argc, char *argv[])
1220512206
} else if (!strcmp(argv[cur_arg], "-R")) {
1220612207
restart_mode = 1;
1220712208
cur_arg++;
12209+
} else if (!strcmp(argv[cur_arg], "-nst")) {
12210+
disable_stack_trace = 1;
12211+
cur_arg++;
1220812212
} else if (!strcmp(argv[cur_arg], "-f")) {
1220912213
forced_mode = 1;
1221012214
argv_restart[j++] = argv[cur_arg];
@@ -12255,6 +12259,9 @@ main(int argc, char *argv[])
1225512259
}
1225612260
argv_restart[j] = 0;
1225712261
start_set_args(argv_restart);
12262+
if (disable_stack_trace <= 0) {
12263+
start_enable_stacktrace(NULL);
12264+
}
1225812265

1225912266
if (!convert_flag && !create_flag) {
1226012267
if (!(pid = start_find_process("ej-users", NULL, 0))) {

0 commit comments

Comments
 (0)