projects
/
paraslash.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6934fc2
)
sc_send_buffer(): Return an error on short writes.
author
Andre Noll
<maan@systemlinux.org>
Sun, 11 Dec 2011 19:28:31 +0000
(20:28 +0100)
committer
Andre Noll
<maan@systemlinux.org>
Fri, 20 Jan 2012 21:57:07 +0000
(22:57 +0100)
This allows all callers to just check for negative return values.
crypt_common.c
patch
|
blob
|
history
diff --git
a/crypt_common.c
b/crypt_common.c
index e02dc6af5b88ac5d5deb83f10d333324448c112a..4e9622e4ee773d65c708bbf3f0b624592ed0e27b 100644
(file)
--- a/
crypt_common.c
+++ b/
crypt_common.c
@@
-337,7
+337,12
@@
int sc_recv_buffer(struct stream_cipher_context *scc, char *buf, size_t size)
int sc_send_buffer(struct stream_cipher_context *scc, char *buf)
{
- return sc_send_bin_buffer(scc, buf, strlen(buf));
+ size_t len = strlen(buf);
+ int ret = sc_send_bin_buffer(scc, buf, len);
+
+ if (ret < 0 || ret == len)
+ return ret;
+ return -E_SHORT_WRITE;
}
__printf_2_3 int sc_send_va_buffer(struct stream_cipher_context *scc,