summaryrefslogtreecommitdiff
path: root/ioexact.c
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-06-17 23:37:23 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-06-17 23:37:23 +0200
commit833ab9522d510197270543e47868d86ec67db5aa (patch)
tree938133b6d9daa7dc8be04cea8b2d984b8a6ac729 /ioexact.c
parent142b191071fb3f0cc4b44e1784b336c2ab9548a7 (diff)
ioexact: make mayexit a bool
It's used as such, so therefore make it a bool instead of int. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Diffstat (limited to 'ioexact.c')
-rw-r--r--ioexact.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ioexact.c b/ioexact.c
index 1600784..7ba6594 100644
--- a/ioexact.c
+++ b/ioexact.c
@@ -1,12 +1,13 @@
#include <errno.h>
#include <unistd.h>
#include <signal.h>
+#include <stdbool.h>
#include "ioexact.h"
extern volatile sig_atomic_t sigint;
-ssize_t read_exact(int fd, void *buf, size_t len, int mayexit)
+ssize_t read_exact(int fd, void *buf, size_t len, bool mayexit)
{
ssize_t num = 0, written;
@@ -21,6 +22,7 @@ ssize_t read_exact(int fd, void *buf, size_t len, int mayexit)
}
if (!written)
return 0;
+
len -= written;
buf += written;
num += written;
@@ -29,7 +31,7 @@ ssize_t read_exact(int fd, void *buf, size_t len, int mayexit)
return num;
}
-ssize_t write_exact(int fd, void *buf, size_t len, int mayexit)
+ssize_t write_exact(int fd, void *buf, size_t len, bool mayexit)
{
ssize_t num = 0, written;
@@ -44,6 +46,7 @@ ssize_t write_exact(int fd, void *buf, size_t len, int mayexit)
}
if (!written)
return 0;
+
len -= written;
buf += written;
num += written;