From 1b15b7c518dc3a46270e4451248e6a5dfa83078d Mon Sep 17 00:00:00 2001 From: noctuum <25441068+noctuum@users.noreply.github.com> Date: Fri, 18 Sep 2026 22:17:59 +0500 Subject: [PATCH] Report a failed write in log.vmmap.dump The dump is only flushed at fclose, whose result was discarded. --- src/command_logging.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/command_logging.cc b/src/command_logging.cc index 8dd47cd3..9931fd05 100644 --- a/src/command_logging.cc +++ b/src/command_logging.cc @@ -122,7 +122,10 @@ log_vmmap_dump(const std::string& str) { fprintf(log_file, "%8p-%8p [%5llxk]\n", all_mapping.ptr, (char*)all_mapping.ptr + all_mapping.length, (long long unsigned int)(all_mapping.length / 1024)); } - fclose(log_file); + // The buffered output only reaches the kernel here. + if (fclose(log_file) != 0) + throw torrent::input_error("Could not write log file: " + str); + return torrent::Object(); }