diff --git a/server.c b/server.c index 870c10c..d52bcb3 100644 --- a/server.c +++ b/server.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "config.h" @@ -548,17 +549,24 @@ static int s1_get(threadtimer_t *timer) { //get kanban timer->is_open = 0; close_file(timer); int r = send_all(kanban_path, timer); - if(!strncmp(timer->data, "quit", 4)) { + if(strnstr(timer->data, "quit", timer->numbytes)) { puts("Found last cmd is quit"); + timer->numbytes = 0; return 0; } + for(int i = 0; i < timer->numbytes; i++) { + if(!isdigit(timer->data[i])) { + timer->numbytes -= i; + break; + } + } return r; } } } } int r = close_file_and_send(timer, "null", 4); - if(!strncmp(timer->data, "quit", 4)) { + if(strnstr(timer->data, "quit", timer->numbytes)) { puts("Found last cmd is quit"); return 0; }