geomyidae

A small C-based gopherd. (gopher://bitreich.org/1/scm/geomyidae)
git clone git://r-36.net/geomyidae
Log | Files | Refs | README | LICENSE

commit 41aaba3aa82bbe810c1008246b2b226e7395fe1e
parent 759d3017c73af279f7e0cec80f328e8da78d397d
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat, 22 Jul 2023 20:16:12 +0200

improve includes and fix a false-positive warning for clang

Tested on OpenBSD

libgen.h is needed for basename().
limits.h is needed for PATH_MAX.

Signed-off-by: Christoph Lohmann <20h@r-36.net>

Diffstat:
Mind.c | 1+
Mmain.c | 3++-
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/ind.c b/ind.c @@ -7,6 +7,7 @@ #define _GNU_SOURCE #endif +#include <libgen.h> #include <unistd.h> #include <stdarg.h> #include <string.h> diff --git a/main.c b/main.c @@ -3,6 +3,7 @@ * by 20h */ +#include <limits.h> #include <unistd.h> #include <dirent.h> #include <memory.h> @@ -346,7 +347,7 @@ dothegopher: for (i = 0; i < sizeof(indexf)/sizeof(indexf[0]); i++) { len = strlen(rpath); - if (len + strlen(indexf[i]) + (rpath[len-1] == '/')? 0 : 1 + if (len + strlen(indexf[i]) + ((rpath[len-1] == '/')? 0 : 1) >= sizeof(rpath)) { if (loglvl & ERRORS) { logentry(clienth, clientp,