diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2014-01-13 09:42:54 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2014-01-13 09:42:54 +0000 |
commit | fb23f08c06cb6da49caac4e7996ce4c6904b9812 (patch) | |
tree | fc2517d1a3e68296a5588e7c49039e1f32994321 /usr.bin | |
parent | adc30e00a0d69f7330c9e74d2948dff911260a32 (diff) |
premature, only wanted to commit n: -> n
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/signify/signify.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/usr.bin/signify/signify.c b/usr.bin/signify/signify.c index c39c665f2dc..314cb1e1f29 100644 --- a/usr.bin/signify/signify.c +++ b/usr.bin/signify/signify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: signify.c,v 1.32 2014/01/13 09:41:16 espie Exp $ */ +/* $OpenBSD: signify.c,v 1.33 2014/01/13 09:42:53 espie Exp $ */ /* * Copyright (c) 2013 Ted Unangst <tedu@openbsd.org> * @@ -119,15 +119,12 @@ static void readall(int fd, void *buf, size_t len, const char *filename) { ssize_t x; - - while (len != 0) { - x = read(fd, buf, len); - if (x == -1) - err(1, "read from %s", filename); - else { - len -= x; - buf += x; - } + + x = read(fd, buf, len); + if (x == -1) { + err(1, "read from %s", filename); + } else if (x != len) { + errx(1, "short read from %s", filename); } } @@ -202,15 +199,12 @@ static void writeall(int fd, const void *buf, size_t len, const char *filename) { ssize_t x; - - while (len != 0) { - x = write(fd, buf, len); - if (x == -1) - err(1, "write to %s", filename); - else { - len -= x; - buf += x; - } + + x = write(fd, buf, len); + if (x == -1) { + err(1, "write to %s", filename); + } else if (x != len) { + errx(1, "short write to %s", filename); } } |