0001-Fix-OAUTH-on-NetBSD.patch
text/x-patch
Filename: 0001-Fix-OAUTH-on-NetBSD.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch 0001
Subject: Fix OAUTH on NetBSD.
| File | + | − |
|---|---|---|
| src/interfaces/libpq/fe-auth-oauth-curl.c | 10 | 0 |
From 7deb153caf552c9bcb380f88eddbca94be33a0c2 Mon Sep 17 00:00:00 2001 From: Thomas Munro <thomas.munro@gmail.com> Date: Sat, 1 Mar 2025 00:27:01 +1300 Subject: [PATCH] Fix OAUTH on NetBSD. NetBSD's EVFILT_TIMER doesn't like zero relative timeouts and fails with EINVAL. Steal the workaround from the same problem on Linux from a few lines up: round 0 up to 1. This could be seen on the optional NetBSD CI task, but not on the NetBSD build farm animals because they aren't finding curl and testing this code. --- src/interfaces/libpq/fe-auth-oauth-curl.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/interfaces/libpq/fe-auth-oauth-curl.c b/src/interfaces/libpq/fe-auth-oauth-curl.c index ae339579f88..6e60a81574d 100644 --- a/src/interfaces/libpq/fe-auth-oauth-curl.c +++ b/src/interfaces/libpq/fe-auth-oauth-curl.c @@ -1363,6 +1363,16 @@ set_timer(struct async_ctx *actx, long timeout) #ifdef HAVE_SYS_EVENT_H struct kevent ev; +#ifdef __NetBSD__ + + /* + * Work around NetBSD's rejection of zero timeouts (EINVAL), a bit like + * timerfd above. + */ + if (timeout == 0) + timeout = 1; +#endif + /* Enable/disable the timer itself. */ EV_SET(&ev, 1, EVFILT_TIMER, timeout < 0 ? EV_DELETE : (EV_ADD | EV_ONESHOT), 0, timeout, 0); -- 2.48.1