# HG changeset patch
# User Olaf Wintermann <olaf.wintermann@gmail.com>
# Date 1564778402 -7200
# Node ID 7fe53d5d587cb5e54c313bf75e9443e0a749ec8b
# Parent  c374d11d672020e271aa6cc7115e25d1790ab91a
fix error handling in net_fallback_sendfile

diff -r c374d11d6720 -r 7fe53d5d587c LICENSE
--- a/LICENSE	Mon Feb 11 09:18:33 2019 +0100
+++ b/LICENSE	Fri Aug 02 22:40:02 2019 +0200
@@ -1,4 +1,4 @@
-Copyright 2013 Olaf Wintermann. All rights reserved.
+Copyright 2019 Olaf Wintermann. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
diff -r c374d11d6720 -r 7fe53d5d587c src/server/util/io.c
--- a/src/server/util/io.c	Mon Feb 11 09:18:33 2019 +0100
+++ b/src/server/util/io.c	Fri Aug 02 22:40:02 2019 +0200
@@ -521,10 +521,16 @@
         char *write_buf = buf;
         while(r > 0) {
             ssize_t w = fd->write(fd, write_buf, r);
+            if(w <= 0) {
+                break;
+            }
             r -= w;
             length -= w;
             write_buf += w;
         }
+        if(r > 0) {
+            break;
+        }
     }
     free(buf);
     if(length > 0) {