Skip to content

Commit 0b2d981

Browse files
author
Michael Vasseur
committed
Check the return code for system commands
Those were left over FIXMEs
1 parent f74e227 commit 0b2d981

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
@@ -334,7 +334,10 @@ function fetch_executable_internal(
334334
$execrunpath = $execbuilddir . '/run';
335335
$execrunjurypath = $execbuilddir . '/runjury';
336336
if (!is_dir($execdir) || !file_exists($execdeploypath)) {
337-
system('rm -rf ' . dj_escapeshellarg($execdir) . ' ' . dj_escapeshellarg($execbuilddir));
337+
system('rm -rf ' . dj_escapeshellarg($execdir) . ' ' . dj_escapeshellarg($execbuilddir), $retval);
338+
if ($retval !== 0) {
339+
error("Deleting '$execdir' or '$execbuilddir' was unsuccessful.");
340+
}
338341
system('mkdir -p ' . dj_escapeshellarg($execbuilddir), $retval);
339342
if ($retval !== 0) {
340343
error("Could not create directory '$execbuilddir'");
@@ -844,7 +847,9 @@ function fetch_executable_internal(
844847
$debug_cmd = implode(' ', array_map('dj_escapeshellarg',
845848
[$runpath, $workdir, $tmpfile]));
846849
system($debug_cmd, $retval);
847-
// FIXME: check retval
850+
if ($retval !== 0) {
851+
error("Running '$runpath' failed.");
852+
}
848853

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

0 commit comments

Comments
 (0)