summaryrefslogtreecommitdiff
path: root/nacl/curvecp/load.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-07-13 10:09:38 -0400
committerirungentoo <irungentoo@gmail.com>2013-07-13 10:09:38 -0400
commitd4fe483efd3e0062f12430efe9deb66d43d914d7 (patch)
treee6aa9ac716ae82cdb15c6e6cb5d9d1d9d29f053b /nacl/curvecp/load.c
parent835ef0320d47372eac14bef31c979b8217d04498 (diff)
NaCl moved to other repo.
Diffstat (limited to 'nacl/curvecp/load.c')
-rw-r--r--nacl/curvecp/load.c33
1 files changed, 0 insertions, 33 deletions
diff --git a/nacl/curvecp/load.c b/nacl/curvecp/load.c
deleted file mode 100644
index 0cd4e43d..00000000
--- a/nacl/curvecp/load.c
+++ /dev/null
@@ -1,33 +0,0 @@
1#include <unistd.h>
2#include "open.h"
3#include "e.h"
4#include "load.h"
5
6static int readall(int fd,void *x,long long xlen)
7{
8 long long r;
9 while (xlen > 0) {
10 r = xlen;
11 if (r > 1048576) r = 1048576;
12 r = read(fd,x,r);
13 if (r == 0) errno = EPROTO;
14 if (r <= 0) {
15 if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) continue;
16 return -1;
17 }
18 x += r;
19 xlen -= r;
20 }
21 return 0;
22}
23
24int load(const char *fn,void *x,long long xlen)
25{
26 int fd;
27 int r;
28 fd = open_read(fn);
29 if (fd == -1) return -1;
30 r = readall(fd,x,xlen);
31 close(fd);
32 return r;
33}