From: Yu Watanabe Date: Wed, 19 Mar 2025 02:30:36 +0000 (+0900) Subject: ptyfwd: use usec_add() X-Git-Tag: v258-rc1~1042^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=707bea6a48646496c9de74054e9405fb334fb20b;p=thirdparty%2Fsystemd.git ptyfwd: use usec_add() Fixes CID#1548038. --- diff --git a/src/shared/ptyfwd.c b/src/shared/ptyfwd.c index d434f8e850f..affa3ba37ca 100644 --- a/src/shared/ptyfwd.c +++ b/src/shared/ptyfwd.c @@ -222,11 +222,11 @@ static RequestOperation look_for_escape(PTYForward *f, const char *buffer, size_ case 0x1D: { /* Check for ^] */ usec_t nw = now(CLOCK_MONOTONIC); - if (f->escape_counter == 0 || nw > f->escape_timestamp + ESCAPE_USEC) { + if (f->escape_counter == 0 || nw > usec_add(f->escape_timestamp, ESCAPE_USEC)) { f->escape_timestamp = nw; f->escape_counter = 1; } else { - (f->escape_counter)++; + f->escape_counter++; if (f->escape_counter >= 3) return REQUEST_EXIT; @@ -237,7 +237,7 @@ static RequestOperation look_for_escape(PTYForward *f, const char *buffer, size_ case 'a'...'z': if (f->escape_counter == 2 && - now(CLOCK_MONOTONIC) <= f->escape_timestamp + ESCAPE_USEC) { + now(CLOCK_MONOTONIC) <= usec_add(f->escape_timestamp, ESCAPE_USEC)) { f->escape_timestamp = 0; f->escape_counter = 0; return REQUEST_HOTKEY_BASE + *p;