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 a10c97c30ba60dc3a6f04007944add595226060d
parent e32a3c324c94aa302f866d422ac6f1340593c01c
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun, 18 Nov 2018 13:09:50 +0100

improve realpath lookup for relative paths

- don't lookup when the path is empty.
- allow relative paths for 'h' types.
- allow URL: in filenames for non-'h' types.

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

Diffstat:
ind.c | 17+++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/ind.c b/ind.c @@ -428,14 +428,15 @@ printelem(int fd, Elems *el, char *file, char *base, char *addr, char *port) * some URL and ignore various types that have different semantics but * to point to some file or directory. */ - if (el->e[2][0] != '/' - && strncmp(el->e[2], "URL:", 4) - && el->e[0][0] != 'i' - && el->e[0][0] != '2' - && el->e[0][0] != '3' - && el->e[0][0] != '8' - && el->e[0][0] != 'w' - && el->e[0][0] != 'T') { + if ((el->e[2][0] != '\0' + && el->e[2][0] != '/' + && el->e[0][0] != 'i' + && el->e[0][0] != '2' + && el->e[0][0] != '3' + && el->e[0][0] != '8' + && el->e[0][0] != 'w' + && el->e[0][0] != 'T') && + !(el->e[0][0] == 'h' && !strncmp(el->e[2], "URL:", 4))) { path = file + strlen(base); if ((p = strrchr(path, '/'))) len = p - path;