Skip to content

Commit 228dbf7

Browse files
author
Michael Vasseur
committed
Check the return code for system commands
Those were left over FIXMEs
1 parent 635d497 commit 228dbf7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

judge/judgedaemon.main.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,10 @@ function fetch_executable_internal(
335335
$execrunjurypath = $execbuilddir . '/runjury';
336336
if (!is_dir($execdir) || !file_exists($execdeploypath) ||
337337
($combined_run_compare && file_get_contents(LIBJUDGEDIR . '/run-interactive.sh')!==file_get_contents($execrunpath))) {
338-
system('rm -rf ' . dj_escapeshellarg($execdir) . ' ' . dj_escapeshellarg($execbuilddir));
338+
system('rm -rf ' . dj_escapeshellarg($execdir) . ' ' . dj_escapeshellarg($execbuilddir), $retval);
339+
if ($retval !== 0) {
340+
error("Deleting '$execdir' or '$execbuilddir' was unsuccessful.");
341+
}
339342
system('mkdir -p ' . dj_escapeshellarg($execbuilddir), $retval);
340343
if ($retval !== 0) {
341344
error("Could not create directory '$execbuilddir'");
@@ -845,7 +848,9 @@ function fetch_executable_internal(
845848
$debug_cmd = implode(' ', array_map('dj_escapeshellarg',
846849
[$runpath, $workdir, $tmpfile]));
847850
system($debug_cmd, $retval);
848-
// FIXME: check retval
851+
if ($retval !== 0) {
852+
error("Running '$runpath' failed.");
853+
}
849854

850855
request(
851856
sprintf('judgehosts/add-debug-info/%s/%s', urlencode($myhost),

0 commit comments

Comments
 (0)