summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2016-09-02 21:48:04 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2016-09-02 21:48:04 +0000
commit33aabbfd39887175418cec9636d905088e54bb76 (patch)
tree874a366c0233c59a25bb46418dda09992acc4496
parent763c871efee63e2f7a02430daa8ef2acda0c491a (diff)
replace exit() with err() and errx() so user knows what happened
-rw-r--r--usr.bin/signify/zsig.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/signify/zsig.c b/usr.bin/signify/zsig.c
index 38413b84e81..485cf290310 100644
--- a/usr.bin/signify/zsig.c
+++ b/usr.bin/signify/zsig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zsig.c,v 1.2 2016/09/02 16:12:09 espie Exp $ */
+/* $OpenBSD: zsig.c,v 1.3 2016/09/02 21:48:03 tedu Exp $ */
/*
* Copyright (c) 2016 Marc Espie <espie@openbsd.org>
*
@@ -71,14 +71,14 @@ readgz_header(struct gzheader *h, int fd)
sz *= 2;
buf = realloc(buf, sz);
if (!buf)
- exit(1);
+ err(1, "realloc");
}
n = read(fd, buf+len, sz-len);
if (n == -1)
- exit(1);
+ err(1, "read");
/* incomplete info */
if (n == 0)
- exit(1);
+ errx(1, "gzheader truncated");
len += n;
h->comment = NULL;
h->name = NULL;
@@ -95,10 +95,10 @@ readgz_header(struct gzheader *h, int fd)
h->os = buf[9];
/* magic gzip header */
if (buf[0] != 0x1f || buf[1] != 0x8b || buf[2] != 8)
- exit(1);
+ err(1, "invalud magic in gzheader");
/* XXX special code that only caters to our needs */
if (h->flg & ~ (FCOMMENT_FLAG | FNAME_FLAG))
- exit(1);
+ err(1, "invalid flags in gzheader");
pos = 10;
state++;
/*FALLTHRU*/
@@ -157,7 +157,7 @@ copy_blocks(int fdout, int fdin, const char *sha, const char *endsha,
while (n != bufsize) {
ssize_t more = read(fdin, buffer+n, bufsize-n);
if (more == -1)
- exit(1);
+ err(1, "read");
n += more;
if (more == 0)
break;