Save finding a realpath on various item types with different semantics. - geomyidae - A small C-based gopherd. HTML git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 44bcfd8e6f0ce9919b41fba0b2245660780d2224 DIR parent dd5de127a721468b97bc4b7741cdb76f17812b8a HTML Author: Christoph Lohmann <20h@r-36.net> Date: Mon, 3 Sep 2018 21:57:09 +0200 Save finding a realpath on various item types with different semantics. Thanks Evil_Bob for pointing this out! Diffstat: M ind.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) --- DIR diff --git a/ind.c b/ind.c @@ -422,7 +422,20 @@ printelem(int fd, Elems *el, char *file, char *base, char *addr, char *port) free(el->e[4]); el->e[4] = xstrdup(port); } - if (el->e[2][0] != '/' && !strncmp(el->e[2], "URL:", 4)) { + + /* + * Ignore if the path is from base, if it might be some h type with + * 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') { path = file + strlen(base); if ((p = strrchr(path, '/'))) len = p - path;