Stripping down the solution to be even more simpler. - 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 bced8f652806e43a593b632643b38cf7e36d4a81 DIR parent b89d42032c1f80875756de5f7c11eee5679951ba HTML Author: Christoph Lohmann <20h@r-36.net> Date: Sun, 26 Apr 2020 13:12:33 +0200 Stripping down the solution to be even more simpler. Thanks Evil_Bob, for your work! Diffstat: M handlr.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) --- DIR diff --git a/handlr.c b/handlr.c @@ -40,15 +40,13 @@ handledir(int sock, char *path, char *port, char *base, char *args, par = xstrdup(pa); b = strrchr(par + strlen(base), '/'); if (b != NULL) { - if (b != par) { - *b = '\0'; - dprintf(sock, "1..\t%s\t%s\t%s\r\n", - par + strlen(base), ohost, port); - } + *b = '\0'; + dprintf(sock, "1..\t%s\t%s\t%s\r\n", + par + strlen(base), ohost, port); } free(par); - ndir = scandir(pa, &dirent, 0, alphasort); + ndir = scandir(pa[0] ? pa : ".", &dirent, 0, alphasort); if (ndir < 0) { perror("scandir"); free(pa);