diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2025-07-04 13:31:15 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2025-07-04 13:31:15 +0300 |
| commit | ec0a19c5a691df2513a931e91e90dab238859d7f (patch) | |
| tree | 554be41303257ee7ef04ee4da8f19a238fc7583b /update_daemon2.php | |
| parent | b0dc82dc7e50e39f589cc0e417385532bebb9821 (diff) | |
replace all instances of die() with print+exit because die() returns exit code 0
Diffstat (limited to 'update_daemon2.php')
| -rwxr-xr-x | update_daemon2.php | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/update_daemon2.php b/update_daemon2.php index 4d80bed0a..25fb205ce 100755 --- a/update_daemon2.php +++ b/update_daemon2.php @@ -13,16 +13,18 @@ Config::sanity_check(); if (!function_exists('pcntl_fork')) { - die("error: This script requires PHP compiled with PCNTL module.\n"); + print("error: This script requires PHP compiled with PCNTL module.\n"); + exit(1); } $options = getopt(""); if (!is_array($options)) { - die("error: getopt() failed. ". + print("error: getopt() failed. ". "Most probably you are using PHP CGI to run this script ". "instead of required PHP CLI. Check tt-rss wiki page on updating feeds for ". "additional information.\n"); + exit(1); } @@ -188,20 +190,23 @@ } if (file_is_locked("update_daemon.lock")) { - die("error: Can't create lockfile. ". + print("error: Can't create lockfile. ". "Maybe another daemon is already running.\n"); + exit(1); } // Try to lock a file in order to avoid concurrent update. $lock_handle = make_lockfile("update_daemon.lock"); if (!$lock_handle) { - die("error: Can't create lockfile. ". + print("error: Can't create lockfile. ". "Maybe another daemon is already running.\n"); + exit(1); } if (Config::is_migration_needed()) { - die("Schema version is wrong, please upgrade the database.\n"); + print("Schema version is wrong, please upgrade the database.\n"); + exit(1); } // Protip: children close shared database handle when terminating, it's a bad idea to @@ -225,7 +230,8 @@ for ($j = count($children); $j < $max_jobs; $j++) { $pid = pcntl_fork(); if ($pid == -1) { - die("fork failed!\n"); + print("fork failed!\n"); + exit(1); } else if ($pid) { if (!$master_handlers_installed) { |