Use xread/xwrite helpers in key.c - dedup - deduplicating backup program
HTML git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
DIR LICENSE
---
DIR commit 9fcd9f91190ab89a777da608d52215631ba4da91
DIR parent dda406622a65ea3905118661977763385ff03d3b
HTML Author: sin <sin@2f30.org>
Date: Fri, 3 May 2019 12:35:01 +0100
Use xread/xwrite helpers in key.c
Diffstat:
M key.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
DIR diff --git a/key.c b/key.c
@@ -5,6 +5,10 @@
#include "config.h"
+/* misc helpers */
+extern ssize_t xread(int, void *, size_t);
+extern ssize_t xwrite(int, void *, size_t);
+
int
keygen(unsigned char *key, size_t n)
{
@@ -23,7 +27,7 @@ savekey(int fd, unsigned char *key, size_t n)
assert(KEYSIZE == crypto_aead_xchacha20poly1305_ietf_KEYBYTES);
if (n != crypto_aead_xchacha20poly1305_ietf_KEYBYTES)
return -1;
- if (write(fd, key, n) != n)
+ if (xwrite(fd, key, n) != n)
return -1;
return 0;
}
@@ -34,7 +38,7 @@ loadkey(int fd, unsigned char *key, size_t n)
assert(KEYSIZE == crypto_aead_xchacha20poly1305_ietf_KEYBYTES);
if (n != crypto_aead_xchacha20poly1305_ietf_KEYBYTES)
return -1;
- if (read(fd, key, n) != n)
+ if (xread(fd, key, n) != n)
return -1;
return 0;
}