summaryrefslogtreecommitdiff
path: root/usr.bin/signify
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2014-01-13 09:41:17 +0000
committerMarc Espie <espie@cvs.openbsd.org>2014-01-13 09:41:17 +0000
commitadc30e00a0d69f7330c9e74d2948dff911260a32 (patch)
tree512efebcb5bfc73f8462216924190bbdc4780050 /usr.bin/signify
parent6bcbd7f126fe0cda6eb773b111bd82ebf8bd7fdd (diff)
duh, -n does not take args
Diffstat (limited to 'usr.bin/signify')
-rw-r--r--usr.bin/signify/signify.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/usr.bin/signify/signify.c b/usr.bin/signify/signify.c
index f018921edec..c39c665f2dc 100644
--- a/usr.bin/signify/signify.c
+++ b/usr.bin/signify/signify.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: signify.c,v 1.31 2014/01/13 01:40:43 tedu Exp $ */
+/* $OpenBSD: signify.c,v 1.32 2014/01/13 09:41:16 espie Exp $ */
/*
* Copyright (c) 2013 Ted Unangst <tedu@openbsd.org>
*
@@ -119,12 +119,15 @@ static void
readall(int fd, void *buf, size_t len, const char *filename)
{
ssize_t 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);
+
+ while (len != 0) {
+ x = read(fd, buf, len);
+ if (x == -1)
+ err(1, "read from %s", filename);
+ else {
+ len -= x;
+ buf += x;
+ }
}
}
@@ -199,12 +202,15 @@ static void
writeall(int fd, const void *buf, size_t len, const char *filename)
{
ssize_t 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);
+
+ while (len != 0) {
+ x = write(fd, buf, len);
+ if (x == -1)
+ err(1, "write to %s", filename);
+ else {
+ len -= x;
+ buf += x;
+ }
}
}
@@ -462,7 +468,7 @@ main(int argc, char **argv)
rounds = 42;
- while ((ch = getopt(argc, argv, "GISVc:em:n:p:s:x:")) != -1) {
+ while ((ch = getopt(argc, argv, "GISVc:em:np:s:x:")) != -1) {
switch (ch) {
#ifndef VERIFYONLY
case 'G':