commit:     89b8b60248bc4a2696363c8c3dec672d12d89126
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 18 09:55:41 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Dec 18 09:55:41 2025 +0000
URL:        https://gitweb.gentoo.org/proj/steve.git/commit/?id=89b8b602

Warn about incorrect tokens once per process

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 steve.cxx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/steve.cxx b/steve.cxx
index cef98d8..5eaf676 100644
--- a/steve.cxx
+++ b/steve.cxx
@@ -91,6 +91,7 @@ struct steve_process {
        event_ptr pidfd_event;
        std::optional<char> extra_token;
        running_job_map running_jobs;
+       bool warned_incorrect_token{false};
 
        ~steve_process() {
                if (pid_fd != -1)
@@ -589,9 +590,10 @@ static void steve_write(
                for (const char *token = data; token < data + size; ++token) {
                        auto it = 
steve_find_running_job(&state->processes[fi->fh], *token);
 
-                       if (static_cast<uint8_t>(it->first & 0xFF) != *token) {
+                       if (static_cast<uint8_t>(it->first & 0xFF) != *token && 
!state->processes[fi->fh].warned_incorrect_token) {
                                std::print(stderr, "Warning: process {} 
returned incorrect token value 0x{:02x}, please report a bug upstream\n",
                                                fi->fh, *token);
+                               state->processes[fi->fh].warned_incorrect_token 
= true;
                        }
                        if (state->verbose)
                                std::print(stderr, "PID {} job 0x{:02x} 
finished after {}\n", fi->fh, it->first,

Reply via email to