commit c8bcb45a39aaf2a63681974aee0943238c4f3323
parent 5c6b459524ba44d6e104d7cfb1170460a5a5bcb1
Author: cowmonk <cowmonk@based.pt>
Date: Wed, 24 Jun 2026 01:22:54 +0000
Serva/svc bug fix
Serva's `close(conn)` doesn't reliably signal EOF to svc's read loop, so
we just explicitly call `shutdown()` to flush the write side. Hopefully
this doesn't cause any issues in the future *knock on wood*.
Diffstat:
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/serva.c b/serva.c
@@ -768,6 +768,7 @@ handle_conn(int conn)
}
writeall(conn, resp, off);
+ shutdown(conn, SHUT_WR);
close(conn);
}
diff --git a/svc.c b/svc.c
@@ -67,6 +67,7 @@ main(int argc, char *argv[])
/* send command, print response */
writeall(sock, buf, strlen(buf));
+ shutdown(sock, SHUT_WR);
while ((n = read(sock, resp, sizeof(resp))) > 0)
writeall(STDOUT_FILENO, resp, n);
close(sock);