xsplice: return -1 on error - geomyidae - A small C-based gopherd.
git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/
Log
Files
Refs
Tags
README
LICENSE
---
commit fc79d9a4d2cd906e09d9f046e9f1cc91e35b0f7e
parent 2ea7fc9967866e29f459515cbac7e03ce10e23a4
Author: Hiltjo Posthuma 
Date:   Fri, 31 Mar 2023 20:22:25 +0200

xsplice: return -1 on error

Signed-off-by: Christoph Lohmann <20h@r-36.net>

Diffstat:
  M ind.c                               |       4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/ind.c b/ind.c
@@ -116,14 +116,14 @@ xsplice(int fd, int sock)
                         BLOCK_SIZE, SPLICE_F_MOVE | SPLICE_F_MORE);
 
                 if (nread <= 0) {
-                        ret = nread < 0 ? 1 : 0;
+                        ret = nread < 0 ? -1 : 0;
                         goto out;
                 }
 
                 nwritten  = splice(pipefd[0], NULL, sock, NULL, BLOCK_SIZE,
                                 SPLICE_F_MOVE | SPLICE_F_MORE);
                 if (nwritten < 0) {
-                        ret = 1;
+                        ret = -1;
                         goto out;
                 }
         } while (nwritten > 0);