Forwarding to dillo-dev, since the list only accepts mails from subscribers. Begin forwarded message: Date: Thu, 30 Oct 2025 11:10:21 -0400 From: John McCue <jmccue@jmcunx.com> To: a1ex@dismail.de Cc: dillo-dev@mailman3.com Subject: Re: Dillo gopher plugin on OpenBSD issue [...] Somehow I missed it seeing there was a list. I found another issues with the gopher plugin on OpenBSD. The issue I am testing is with dpi.c. On OpenBSD, it has to do with how clang works on OpenBSD. The diffs are below. So far, with the changes to io.c and dpi.c, the plugin works fine on both OpenBSD and NetBSD. diff --git a/io.c b/io.c index 615f346..a10a0b3 100644 --- a/io.c +++ b/io.c @@ -1,3 +1,4 @@ +#include <sys/param.h> #include <string.h> #include <errno.h> #include <unistd.h> @@ -8,6 +9,12 @@ #include <netdb.h> #include <netinet/in.h> +#ifdef OpenBSD +#include <sys/socket.h> +#include <net/if.h> +#include <net/route.h> +#endif + #include "io.h" int read_all(int fd, unsigned char *buf, size_t len) { diff --git a/dpi.c b/dpi.c index 7b38800..52547f8 100644 --- a/dpi.c +++ b/dpi.c @@ -7,7 +7,7 @@ #include "io.h" static void check_auth() { - char buf[30]; + char buf[31]; int rc; char key[4], local_key[4]; char keys[128]; @@ -16,16 +16,16 @@ static void check_auth() { rc = read_all(STDIN_FILENO, buf, 29); if (rc < 0) err(1, "read auth"); buf[30] = '\0'; - rc = sscanf(buf, "<cmd='auth' msg='%4x' '>", key); + rc = sscanf(buf, "<cmd='auth' msg='%4x' '>", (unsigned int *) key); if (rc < 0) err(1, "auth: %.*s", 29, buf); if (rc < 1) errx(1, "auth: %.*s", 29, buf); home = getenv("HOME"); if (!home) home = "."; sz = read_file(keys, sizeof(keys), "%s/.dillo/dpid_comm_keys", home); if (sz < 0) err(1, "read dillo comm keys"); - rc = sscanf(keys, "%*d %4x' '>", local_key); - if (rc < 0) err(1, "comm key: %.*s", sz, keys); - if (rc < 1) errx(1, "comm key: %.*s", sz, keys); + rc = sscanf(keys, "%*d %4x' '>", (unsigned int *) local_key); + if (rc < 0) err(1, "comm key: %.*s", (int) sz, keys); + if (rc < 1) errx(1, "comm key: %.*s", (int) sz, keys); if (memcmp(key, local_key, 4)) errx(1, "wrong dillo key"); } @@ -38,7 +38,7 @@ static void get_url(char *url_buf, size_t url_len) { rc = read_all(STDIN_FILENO, buf, sizeof(buf)); if (rc < 0) err(1, "read open_url"); if (strncmp(buf, "<cmd='open_url' url='", 21)) { - err(1, "bad open_url cmd: %.*s", sizeof(buf), buf); + err(1, "bad open_url cmd: %.*s", (int) sizeof(buf), buf); } len = url_len; rc = read_some(STDIN_FILENO, url_buf, &len); @@ -48,7 +48,7 @@ static void get_url(char *url_buf, size_t url_len) { if (url_buf[i] == '\'' && url_buf[i+1] == ' ') break; } if (i > len-3 || strncmp(url_buf + i, "' '>", 4)) { - err(1, "bad url end: %.*s", len, url_buf); + err(1, "bad url end: %.*s", (int) len, url_buf); } url_buf[i] = '\0'; }
participants (1)
-
a1ex@dismail.de