From 2e2f91c92bbdd4107925bcaf521242c588afbfe4 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 11 Dec 2011 20:23:14 +0100 Subject: [PATCH] sc_send_result(): Error out on short writes. 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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/afs.c b/afs.c index 46ed6913..73f2c65a 100644 --- 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) -- 2.39.5