From 876754a5a55e076a56e98e4ed3fc7e82589e2afa Mon Sep 17 00:00:00 2001 From: Victor Dubiniuk Date: Tue, 13 Dec 2016 20:45:48 +0300 Subject: Check return value for file_put_contents. Add return value to the commands Signed-off-by: Lukas Reschke --- core/Command/Integrity/SignCore.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'core/Command/Integrity/SignCore.php') diff --git a/core/Command/Integrity/SignCore.php b/core/Command/Integrity/SignCore.php index 440c3da3b23..8f951204a58 100644 --- a/core/Command/Integrity/SignCore.php +++ b/core/Command/Integrity/SignCore.php @@ -23,12 +23,10 @@ namespace OC\Core\Command\Integrity; use OC\IntegrityCheck\Checker; -use OC\IntegrityCheck\Helpers\EnvironmentHelper; use OC\IntegrityCheck\Helpers\FileAccessHelper; use phpseclib\Crypt\RSA; use phpseclib\File\X509; use Symfony\Component\Console\Command\Command; -use OCP\IConfig; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -94,8 +92,14 @@ class SignCore extends Command { $x509 = new X509(); $x509->loadX509($keyBundle); $x509->setPrivateKey($rsa); - $this->checker->writeCoreSignature($x509, $rsa, $path); - $output->writeln('Successfully signed "core"'); + try { + $this->checker->writeCoreSignature($x509, $rsa, $path); + $output->writeln('Successfully signed "core"'); + } catch (\Exception $e){ + $output->writeln('Error: ' . $e->getMessage()); + return 1; + } + return 0; } } -- cgit v1.2.3