From 03d6feb440e15489d9ff5b7f2df06d4c48a1721a Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 11 Aug 2008 08:31:08 +0000 Subject: [PATCH] Eliminate usage. Inspired by: Solaris patch from Theo Schlossnagle git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3076 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishtest/vtc.c | 16 ++++++++++------ varnish-cache/bin/varnishtest/vtc_log.c | 1 - 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/varnish-cache/bin/varnishtest/vtc.c b/varnish-cache/bin/varnishtest/vtc.c index fc263ce1..a4fe5e6a 100644 --- a/varnish-cache/bin/varnishtest/vtc.c +++ b/varnish-cache/bin/varnishtest/vtc.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "libvarnish.h" #include "vsb.h" @@ -57,13 +56,17 @@ read_file(const char *fn) int fd; fd = open(fn, O_RDONLY); - if (fd < 0) - err(1, "Cannot open %s", fn); + if (fd < 0) { + fprintf(stderr, "Cannot open %s: %s", fn, strerror(errno)); + exit (1); + } buf = malloc(sz); assert(buf != NULL); s = read(fd, buf, sz - 1); - if (s <= 0) - err(1, "Cannot read %s", fn); + if (s <= 0) { + fprintf(stderr, "Cannot read %s: %s", fn, strerror(errno)); + exit (1); + } AZ(close (fd)); assert(s < sz); /* XXX: increase MAX_FILESIZE */ buf[s] = '\0'; @@ -175,7 +178,8 @@ parse_string(char *buf, const struct cmds *cmd, void *priv) for (tn = 0; token_s[tn] != NULL; tn++) fprintf(stderr, "%s ", token_s[tn]); fprintf(stderr, "\n"); - errx(1, "Unknown command: \"%s\"", token_s[0]); + fprintf(stderr, "Unknown command: \"%s\"", token_s[0]); + exit (1); } assert(cp->cmd != NULL); diff --git a/varnish-cache/bin/varnishtest/vtc_log.c b/varnish-cache/bin/varnishtest/vtc_log.c index 089a5865..50715054 100644 --- a/varnish-cache/bin/varnishtest/vtc_log.c +++ b/varnish-cache/bin/varnishtest/vtc_log.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include -- 2.39.5