]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - afs.c
sc_send_result(): Error out on short writes.
[paraslash.git] / afs.c
diff --git a/afs.c b/afs.c
index 263f1818a2763522fd04bacbc153ccdaffce1f35..73f2c65a3d87cdd4a2ab3861985d25047140e44a 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -233,7 +233,7 @@ int send_callback_request(callback_function *f, struct osl_object *query,
        if (ret < 0)
                goto out;
        fd = ret;
-       ret = send_bin_buffer(fd, buf, sizeof(buf));
+       ret = write_all(fd, buf, sizeof(buf));
        if (ret < 0)
                goto out;
        /*
@@ -495,7 +495,7 @@ destroy:
 no_admissible_files:
        *(uint32_t *)buf = NO_ADMISSIBLE_FILES;
        *(uint32_t *)(buf + 4) = (uint32_t)0;
-       return send_bin_buffer(server_socket, buf, 8);
+       return write_all(server_socket, buf, 8);
 }
 
 /* Never fails if arg == NULL */
@@ -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)
@@ -814,7 +818,7 @@ int pass_buffer_as_shm(char *buf, size_t size, void *fd_ptr)
        ret = shm_detach(shm);
        if (ret < 0)
                goto err;
-       ret = send_bin_buffer(fd, (char *)&shmid, sizeof(int));
+       ret = write_all(fd, (char *)&shmid, sizeof(int));
        if (ret >= 0)
                return ret;
 err: