mirror of
https://github.com/systemd/systemd.git
synced 2026-06-30 19:57:29 +00:00
random-seed: fix wrong error variable in log_error_errno()
At line 285, ftruncate() failure was logged using 'r' which is 0 from the preceding successful loop_write() call. log_error_errno(0, ...) triggers an assertion crash in developer builds (ASSERT_NON_ZERO) and silently returns success in release builds, swallowing the ftruncate error. Replace with errno which is set by ftruncate() on failure. Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com> Co-developed-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
committed by
Daan De Meyer
parent
da2ed93b65
commit
2ef8fb91cc
@@ -282,7 +282,7 @@ static int save_seed_file(
|
||||
return log_error_errno(r, "Failed to write new random seed file: %m");
|
||||
|
||||
if (ftruncate(seed_fd, k) < 0)
|
||||
return log_error_errno(r, "Failed to truncate random seed file: %m");
|
||||
return log_error_errno(errno, "Failed to truncate random seed file: %m");
|
||||
|
||||
r = fsync_full(seed_fd);
|
||||
if (r < 0)
|
||||
|
||||
Reference in New Issue
Block a user