use strcmp (without length) for NUL terminated strings - 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 9ae1515e88c21de6e69311895af71e92e20f33c7 DIR parent efc6bf445a594d555bfce6dd4487366f8dbb747e HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Mon, 10 Jul 2017 20:23:30 +0200 use strcmp (without length) for NUL terminated strings Signed-off-by: Christoph Lohmann <20h@r-36.net> Diffstat: M ind.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- DIR diff --git a/ind.c b/ind.c @@ -104,7 +104,7 @@ gettype(char *filename) end++; for(i = 0; type[i].end != nil; i++) - if(!strncasecmp(end, type[i].end, strlen(type[i].end))) + if(!strcasecmp(end, type[i].end)) return &type[i]; return &type[0]; @@ -249,11 +249,11 @@ void printelem(int fd, Elems *el, char *addr, char *port) { - if(!strncmp(el->e[3], "server", 6)) { + if(!strcmp(el->e[3], "server")) { free(el->e[3]); el->e[3] = xstrdup(addr); } - if(!strncmp(el->e[4], "port", 4)) { + if(!strcmp(el->e[4], "port")) { free(el->e[4]); el->e[4] = xstrdup(port); }