fix error handling in net_fallback_sendfile

Fri, 02 Aug 2019 22:40:02 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 02 Aug 2019 22:40:02 +0200
changeset 203
7fe53d5d587c
parent 202
c374d11d6720
child 204
e870a7c8f223

fix error handling in net_fallback_sendfile

LICENSE file | annotate | diff | comparison | revisions
src/server/util/io.c file | annotate | diff | comparison | revisions
--- 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:
--- 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) {

mercurial