Use write instead of send everywhere. - geomyidae - A small C-based gopherd.
git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/
Log
Files
Refs
Tags
README
LICENSE
---
commit 0c2fa66d5056ca6cdd6cf69aa7feb416b21a3ff0
parent 429ea45adba32c7ffa87b8b00528e26edc701e74
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sun,  7 Jun 2020 21:43:26 +0200

Use write instead of send everywhere.

Sorry, Evil_Bob, had to garble your patch. Thanks for the hint!

Diffstat:
  M ind.c                               |       2 +-
  M main.c                              |       2 +-

2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/ind.c b/ind.c
@@ -123,7 +123,7 @@ xsendfile(int fd, int sock)
         while ((len = read(fd, sendb, bufsiz)) > 0) {
                 sendi = sendb;
                 while (len > 0) {
-                        if ((sent = send(sock, sendi, len, 0)) < 0) {
+                        if ((sent = write(sock, sendi, len)) < 0) {
                                 free(sendb);
                                 return -1;
                         }
diff --git a/main.c b/main.c
@@ -170,7 +170,7 @@ handlerequest(int sock, char *req, int rlen, char *base, char *ohost,
                                 recvb + 4, recvb + 4, recvb + 4);
                 if (len > sizeof(path))
                         len = sizeof(path);
-                send(sock, path, len, 0);
+                write(sock, path, len);
                 if (loglvl & HTTP)
                         logentry(clienth, clientp, recvc, "HTTP redirect");
                 return;