diff --git a/httpd.c b/httpd.c index d4eb456..b9ffd7b 100644 --- a/httpd.c +++ b/httpd.c @@ -164,11 +164,9 @@ void cat(int client, FILE *resource) { char buf[1024]; - fgets(buf, sizeof(buf), resource); - while (!feof(resource)) + while (fgets(buf, sizeof(buf), resource) != NULL) { send(client, buf, strlen(buf), 0); - fgets(buf, sizeof(buf), resource); } }