From: des Date: Fri, 25 Jan 2008 16:00:42 +0000 (+0000) Subject: Don't print strerror(errno) unless errno != 0. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae19320d08b72493f314443855576e25ce8f37ef;p=varnish Don't print strerror(errno) unless errno != 0. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2387 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/lib/libvarnish/assert.c b/varnish-cache/lib/libvarnish/assert.c index 0dbd03ef..471058ae 100644 --- a/varnish-cache/lib/libvarnish/assert.c +++ b/varnish-cache/lib/libvarnish/assert.c @@ -42,8 +42,11 @@ lbv_xxxassert(const char *func, const char *file, int line, const char *cond, in fprintf(stderr, "Missing errorhandling code in %s(), %s line %d:\n" - " Condition(%s) not true.\n" - " errno = %d (%s)\n", func, file, line, cond, err, strerror(err)); + " Condition(%s) not true.\n", + func, file, line, cond); + if (err) + fprintf(stderr, + " errno = %d (%s)\n", err, strerror(err)); abort(); } @@ -53,7 +56,10 @@ lbv_assert(const char *func, const char *file, int line, const char *cond, int e fprintf(stderr, "Assert error in %s(), %s line %d:\n" - " Condition(%s) not true.\n" - " errno = %d (%s)\n", func, file, line, cond, err, strerror(err)); + " Condition(%s) not true.\n", + func, file, line, cond); + if (err) + fprintf(stderr, + " errno = %d (%s)\n", err, strerror(err)); abort(); }