]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
sc_send_result(): Error out on short writes.
authorAndre Noll <maan@systemlinux.org>
Sun, 11 Dec 2011 19:23:14 +0000 (20:23 +0100)
committerAndre Noll <maan@systemlinux.org>
Fri, 20 Jan 2012 21:57:07 +0000 (22:57 +0100)
This affects only afs command handlers, where short writes should
never happen as the socket fd is set to blocking mode. But still.

afs.c

diff --git a/afs.c b/afs.c
index 46ed6913626482c07eae50c99b943aaa39e275db..73f2c65a3d87cdd4a2ab3861985d25047140e44a 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -593,10 +593,14 @@ out:
 int sc_send_result(struct osl_object *result, void *private)
 {
        struct stream_cipher_context *scc = private;
+       int ret;
 
        if (!result->size)
                return 1;
-       return sc_send_bin_buffer(scc, result->data, result->size);
+       ret = sc_send_bin_buffer(scc, result->data, result->size);
+       if (ret < 0 || ret == result->size)
+               return ret;
+       return -E_SHORT_WRITE;
 }
 
 int com_select(struct stream_cipher_context *scc, int argc, char * const * const argv)