public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] tap: Fix EAGAIN/EWOULDBLOCK check in tap_pasta_input()
@ 2026-07-16 17:21 Hayato Kiwata
  2026-07-17  1:30 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Hayato Kiwata @ 2026-07-16 17:21 UTC (permalink / raw)
  To: passt-dev; +Cc: Hayato Kiwata

On Linux, EAGAIN and EWOULDBLOCK have the same value. Commit
d2a1dc744b10 ("tap: Restructure in tap_pasta_input()") added a check for
EWOULDBLOCK on purpose:

> - Check for EWOULDBLOCK as well as EAGAIN for the benefit of any future
>   ports where those might not have the same value

However, the condition uses && instead of ||, so it can never be true on a
platform where EAGAIN and EWOULDBLOCK are different.

Use || instead so that the check works as intended on such platforms.

Fixes: d2a1dc744b10 ("tap: Restructure in tap_pasta_input()")

Signed-off-by: Hayato Kiwata <dev@haytok.jp>
---
 tap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tap.c b/tap.c
index d418961..cf87591 100644
--- a/tap.c
+++ b/tap.c
@@ -1329,7 +1329,7 @@ static void tap_pasta_input(struct ctx *c, const struct timespec *now)
 				continue;
 			}
 
-			if (errno == EAGAIN && errno == EWOULDBLOCK)
+			if (errno == EAGAIN || errno == EWOULDBLOCK)
 				break; /* all done for now */
 
 			die("Error on tap device, exiting");
-- 
2.39.5 (Apple Git-154)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] tap: Fix EAGAIN/EWOULDBLOCK check in tap_pasta_input()
  2026-07-16 17:21 [PATCH] tap: Fix EAGAIN/EWOULDBLOCK check in tap_pasta_input() Hayato Kiwata
@ 2026-07-17  1:30 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2026-07-17  1:30 UTC (permalink / raw)
  To: Hayato Kiwata; +Cc: passt-dev

[-- Attachment #1: Type: text/plain, Size: 1509 bytes --]

On Fri, Jul 17, 2026 at 02:21:21AM +0900, Hayato Kiwata wrote:
> On Linux, EAGAIN and EWOULDBLOCK have the same value. Commit
> d2a1dc744b10 ("tap: Restructure in tap_pasta_input()") added a check for
> EWOULDBLOCK on purpose:
> 
> > - Check for EWOULDBLOCK as well as EAGAIN for the benefit of any future
> >   ports where those might not have the same value
> 
> However, the condition uses && instead of ||, so it can never be true on a
> platform where EAGAIN and EWOULDBLOCK are different.
> 
> Use || instead so that the check works as intended on such platforms.
> 
> Fixes: d2a1dc744b10 ("tap: Restructure in tap_pasta_input()")
> 
> Signed-off-by: Hayato Kiwata <dev@haytok.jp>

Oops, mea culpa.

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  tap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tap.c b/tap.c
> index d418961..cf87591 100644
> --- a/tap.c
> +++ b/tap.c
> @@ -1329,7 +1329,7 @@ static void tap_pasta_input(struct ctx *c, const struct timespec *now)
>  				continue;
>  			}
>  
> -			if (errno == EAGAIN && errno == EWOULDBLOCK)
> +			if (errno == EAGAIN || errno == EWOULDBLOCK)
>  				break; /* all done for now */
>  
>  			die("Error on tap device, exiting");
> -- 
> 2.39.5 (Apple Git-154)
> 

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-17  1:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-16 17:21 [PATCH] tap: Fix EAGAIN/EWOULDBLOCK check in tap_pasta_input() Hayato Kiwata
2026-07-17  1:30 ` David Gibson

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).