sc_send_result(): Error out on short writes.
[paraslash.git] / afs.c
diff --git a/afs.c b/afs.c
index 46ed691..73f2c65 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)