| Do not output .., if base is empty. - geomyidae - A small C-based gopherd. | |
| git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfri… | |
| Log | |
| Files | |
| Refs | |
| Tags | |
| README | |
| LICENSE | |
| --- | |
| commit b89d42032c1f80875756de5f7c11eee5679951ba | |
| parent 828c9cc5ebc09271b73a3847aede892168d64765 | |
| Author: Christoph Lohmann <[email protected]> | |
| Date: Sun, 26 Apr 2020 12:34:24 +0200 | |
| Do not output .., if base is empty. | |
| Diffstat: | |
| M handlr.c | 7 ++++--- | |
| 1 file changed, 4 insertions(+), 3 deletions(-) | |
| --- | |
| diff --git a/handlr.c b/handlr.c | |
| @@ -40,10 +40,11 @@ handledir(int sock, char *path, char *port, char *base, cha… | |
| par = xstrdup(pa); | |
| b = strrchr(par + strlen(base), '/'); | |
| if (b != NULL) { | |
| - if (strlen(par) > 1) | |
| + if (b != par) { | |
| *b = '\0'; | |
| - dprintf(sock, "1..\t%s\t%s\t%s\r\n", | |
| - par + strlen(base), ohost, port); | |
| + dprintf(sock, "1..\t%s\t%s\t%s\r\n", | |
| + par + strlen(base), ohost, port); | |
| + } | |
| } | |
| free(par); | |