Merge pull request #4758 from nextcloud/fix_3470

Do not write and read rootcerts.crt at the same time
This commit is contained in:
Roeland Jago Douma 2017-05-09 15:00:35 +02:00 committed by GitHub
commit b9bcc819bd
1 changed files with 3 additions and 2 deletions

View File

@ -119,7 +119,8 @@ class CertificateManager implements ICertificateManager {
return; return;
} }
$fhCerts = $this->view->fopen($path . '/rootcerts.crt', 'w'); $certPath = $path . 'rootcerts.crt';
$fhCerts = $this->view->fopen($certPath, 'w');
// Write user certificates // Write user certificates
foreach ($certs as $cert) { foreach ($certs as $cert) {
@ -136,7 +137,7 @@ class CertificateManager implements ICertificateManager {
// Append the system certificate bundle // Append the system certificate bundle
$systemBundle = $this->getCertificateBundle(null); $systemBundle = $this->getCertificateBundle(null);
if ($this->view->file_exists($systemBundle)) { if ($systemBundle !== $certPath && $this->view->file_exists($systemBundle)) {
$systemCertificates = $this->view->file_get_contents($systemBundle); $systemCertificates = $this->view->file_get_contents($systemBundle);
fwrite($fhCerts, $systemCertificates); fwrite($fhCerts, $systemCertificates);
} }