summaryrefslogtreecommitdiffstats
path: root/usr.bin/file/compress.c
diff options
context:
space:
mode:
authormickey <mickey@openbsd.org>1998-07-10 15:05:13 +0000
committermickey <mickey@openbsd.org>1998-07-10 15:05:13 +0000
commit840b8a8206b837e410c6475080a22bd41a619f7c (patch)
tree14c7ec9fd46dc1703e09737b139c13d5560935ae /usr.bin/file/compress.c
parentuse err/warn (diff)
downloadwireguard-openbsd-840b8a8206b837e410c6475080a22bd41a619f7c.tar.xz
wireguard-openbsd-840b8a8206b837e410c6475080a22bd41a619f7c.zip
err/warn
Diffstat (limited to 'usr.bin/file/compress.c')
-rw-r--r--usr.bin/file/compress.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.bin/file/compress.c b/usr.bin/file/compress.c
index bde1ff4a9d7..7c6ef4d42a2 100644
--- a/usr.bin/file/compress.c
+++ b/usr.bin/file/compress.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: compress.c,v 1.3 1997/02/09 23:58:19 millert Exp $ */
+/* $OpenBSD: compress.c,v 1.4 1998/07/10 15:05:19 mickey Exp $ */
/*
* compress routines:
@@ -7,11 +7,12 @@
* uncompress(method, old, n, newch) - uncompress old into new,
* using method, return sizeof new
*/
+#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <sys/wait.h>
+#include <err.h>
#include "file.h"
@@ -74,7 +75,7 @@ int n;
int fdin[2], fdout[2];
if (pipe(fdin) == -1 || pipe(fdout) == -1) {
- error("cannot create pipe (%s).\n", strerror(errno));
+ err(1, "cannot create pipe");
/*NOTREACHED*/
}
switch (fork()) {
@@ -92,28 +93,27 @@ int n;
(void) close(2);
execvp(compr[method].argv[0], compr[method].argv);
- error("could not execute `%s' (%s).\n",
- compr[method].argv[0], strerror(errno));
+ err(1, "could not execute `%s'", compr[method].argv[0]);
/*NOTREACHED*/
case -1:
- error("could not fork (%s).\n", strerror(errno));
+ err(1, "could not fork");
/*NOTREACHED*/
default: /* parent */
(void) close(fdin[0]);
(void) close(fdout[1]);
if (write(fdin[1], old, n) != n) {
- error("write failed (%s).\n", strerror(errno));
+ err(1, "write failed");
/*NOTREACHED*/
}
(void) close(fdin[1]);
if ((*newch = (unsigned char *) malloc(n)) == NULL) {
- error("out of memory.\n");
+ err(1, "malloc");
/*NOTREACHED*/
}
if ((n = read(fdout[0], *newch, n)) <= 0) {
free(*newch);
- error("read failed (%s).\n", strerror(errno));
+ err(1, "read failed");
/*NOTREACHED*/
}
(void) close(fdout[0]);