From eb5bd7b247e6559fe34a01cf36dd43ac4763f7e8 Mon Sep 17 00:00:00 2001 From: Meek Msaki <98189596+mmsaki@users.noreply.github.com> Date: Fri, 23 Aug 2024 17:37:58 -0500 Subject: [PATCH 1/2] change `addr_len` to type socklen_t instead of int and fixed while condition --- foundation/software.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/foundation/software.rst b/foundation/software.rst index a396c20..89669f0 100644 --- a/foundation/software.rst +++ b/foundation/software.rst @@ -326,7 +326,8 @@ out the characters that arrive on the connection. { struct sockaddr_in sin; char buf[MAX_LINE]; - int buf_len, addr_len; + int buf_len; + socklen_t addr_len; int s, new_s; /* build address data structure */ @@ -352,7 +353,7 @@ out the characters that arrive on the connection. perror("simplex-talk: accept"); exit(1); } - while (buf_len = recv(new_s, buf, sizeof(buf), 0)) + while (buf_len == recv(new_s, buf, sizeof(buf), 0)) fputs(buf, stdout); close(new_s); } From e026e1c66771fdd51e4a180adde38c24ad41670f Mon Sep 17 00:00:00 2001 From: Meek Msaki <98189596+mmsaki@users.noreply.github.com> Date: Mon, 9 Sep 2024 12:46:20 -0500 Subject: [PATCH 2/2] fix checks if recv call succeeded --- foundation/software.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foundation/software.rst b/foundation/software.rst index 89669f0..660c037 100644 --- a/foundation/software.rst +++ b/foundation/software.rst @@ -353,7 +353,7 @@ out the characters that arrive on the connection. perror("simplex-talk: accept"); exit(1); } - while (buf_len == recv(new_s, buf, sizeof(buf), 0)) + while (buf_len = recv(new_s, buf, sizeof(buf), 0)) fputs(buf, stdout); close(new_s); }