From fa0dbed44cf05f2de44e9fd34a71db60c97e4101 Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Thu, 13 Oct 2022 14:57:26 +0100 Subject: [PATCH] Write an empty response to clients --- main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 5a00135..0b4b774 100644 --- a/main.c +++ b/main.c @@ -142,8 +142,17 @@ int main(int argc, char *argv[]) goto close_client_socket; } - sbuf[slen] = '\0'; - printf("Received selector: \"%s\"\n", sbuf); + /* + * Write an empty response to the client. + */ + do { + errno = 0; + n = write(cfd, ".\r\n", 3); + } while (errno == EINTR); + if (n == -1) { + fprintf(stderr, "Error sending response to client\n"); + goto close_client_socket; + } close_client_socket: close(cfd);