Skip to content

Commit 8d5af54

Browse files
author
Michael Vasseur
committed
Check the return code for system commands
Those were left over FIXMEs
1 parent 64f40b5 commit 8d5af54

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
@@ -399,7 +399,10 @@ function fetch_executable_internal(
399399
$execrunjurypath = $execbuilddir . '/runjury';
400400
if (!is_dir($execdir) || !file_exists($execdeploypath) ||
401401
($combined_run_compare && file_get_contents(LIBJUDGEDIR . '/run-interactive.sh')!==file_get_contents($execrunpath))) {
402-
system('rm -rf ' . dj_escapeshellarg($execdir) . ' ' . dj_escapeshellarg($execbuilddir));
402+
system('rm -rf ' . dj_escapeshellarg($execdir) . ' ' . dj_escapeshellarg($execbuilddir), $retval);
403+
if ($retval !== 0) {
404+
error("Deleting '$execdir' or '$execbuilddir' was unsuccessful.");
405+
}
403406
system('mkdir -p ' . dj_escapeshellarg($execbuilddir), $retval);
404407
if ($retval !== 0) {
405408
error("Could not create directory '$execbuilddir'");
@@ -904,7 +907,9 @@ function fetch_executable_internal(
904907
$debug_cmd = implode(' ', array_map('dj_escapeshellarg',
905908
[$runpath, $workdir, $tmpfile]));
906909
system($debug_cmd, $retval);
907-
// FIXME: check retval
910+
if ($retval !== 0) {
911+
error("Running '$runpath' failed.");
912+
}
908913

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

0 commit comments

Comments
 (0)