From 0a74256241a27aba4e79fb067c69cbdd911cd1b4 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 8 Jun 2023 14:51:28 +0200 Subject: [PATCH] system: remove vmcore files earlier --- src/www/crash_reporter.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/www/crash_reporter.php b/src/www/crash_reporter.php index 052a78d52..a04f179fa 100644 --- a/src/www/crash_reporter.php +++ b/src/www/crash_reporter.php @@ -143,6 +143,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { } } if ($count || (!empty($desc) && !empty($email))) { + $files_to_upload = glob('/var/crash/*'); + foreach ($files_to_upload as $key => $file) { + if (filesize($file) > 450000) { + unset($files_to_upload[$key]); + @unlink($file); + } + } file_put_contents('/var/crash/crashreport_header.txt', $crash_report_header); if (file_exists('/tmp/PHP_errors.log')) { // limit PHP_errors to send to 1MB @@ -152,11 +159,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { @copy('/var/run/dmesg.boot', '/var/crash/dmesg.boot'); exec('/usr/bin/gzip /var/crash/*'); $files_to_upload = glob('/var/crash/*'); - foreach ($files_to_upload as $key => $file) { - if (filesize($file) > 450000) { - unset($files_to_upload[$key]); - } - } upload_crash_report($files_to_upload, $user_agent); foreach ($files_to_upload as $file_to_upload) { @unlink($file_to_upload);