[master] 6b47177 Remove the errno argument from our varnish-assert function, the intended purpose never materialized and it causes massive <errno.h> polution.
Poul-Henning Kamp
phk at FreeBSD.org
Wed Mar 18 22:00:32 CET 2015
commit 6b4717703ca5dc544d7964dd6b173d75fabbd12a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Mar 18 20:36:54 2015 +0000
Remove the errno argument from our varnish-assert function, the intended
purpose never materialized and it causes massive <errno.h> polution.
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index bdc3ad4..9615efe 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -491,12 +491,13 @@ pan_backtrace(void)
static void __attribute__((__noreturn__))
pan_ic(const char *func, const char *file, int line, const char *cond,
- int err, enum vas_e kind)
+ enum vas_e kind)
{
const char *q;
struct req *req;
struct busyobj *bo;
struct sigaction sa;
+ int err = errno;
AZ(pthread_mutex_lock(&panicstr_mtx)); /* Won't be released,
we're going to die
diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 2dfacf4..e67b419 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -282,7 +282,6 @@ child_sigsegv_handler(int s, siginfo_t *si, void *c)
__FILE__,
__LINE__,
buf,
- errno,
VAS_ASSERT);
}
diff --git a/bin/varnishtest/vtc_log.c b/bin/varnishtest/vtc_log.c
index 57ee43c..4a73ebd 100644
--- a/bin/varnishtest/vtc_log.c
+++ b/bin/varnishtest/vtc_log.c
@@ -289,11 +289,10 @@ vtc_hexdump(struct vtclog *vl, int lvl, const char *pfx,
static void __attribute__((__noreturn__))
vtc_log_VAS_Fail(const char *func, const char *file, int line,
- const char *cond, int err, enum vas_e why)
+ const char *cond, enum vas_e why)
{
struct vtclog *vl;
- (void)err;
(void)why;
vl = pthread_getspecific(log_key);
if (vl == NULL || vl->act) {
diff --git a/include/vas.h b/include/vas.h
index 246acc1..591d99e 100644
--- a/include/vas.h
+++ b/include/vas.h
@@ -46,8 +46,7 @@ enum vas_e {
VAS_VCL,
};
-typedef void vas_f(const char *, const char *, int, const char *, int,
- enum vas_e);
+typedef void vas_f(const char *, const char *, int, const char *, enum vas_e);
extern vas_f *VAS_Fail __attribute__((__noreturn__));
@@ -58,7 +57,7 @@ extern vas_f *VAS_Fail __attribute__((__noreturn__));
do { \
if (!(e)) { \
VAS_Fail(__func__, __FILE__, __LINE__, \
- #e, errno, VAS_ASSERT); \
+ #e, VAS_ASSERT); \
} \
} while (0)
#endif
@@ -67,7 +66,7 @@ do { \
do { \
if (!(e)) { \
VAS_Fail(__func__, __FILE__, __LINE__, \
- #e, errno, VAS_MISSING); \
+ #e, VAS_MISSING); \
} \
} while (0)
@@ -79,13 +78,13 @@ do { \
#define diagnostic(foo) assert(foo)
#define WRONG(expl) \
do { \
- VAS_Fail(__func__, __FILE__, __LINE__, expl, errno, VAS_WRONG); \
+ VAS_Fail(__func__, __FILE__, __LINE__, expl, VAS_WRONG); \
} while (0)
#define INCOMPL() \
do { \
VAS_Fail(__func__, __FILE__, __LINE__, \
- "", errno, VAS_INCOMPLETE); \
+ "", VAS_INCOMPLETE); \
} while (0)
#endif
diff --git a/lib/libvarnish/vas.c b/lib/libvarnish/vas.c
index 9380b6c..2d810d2 100644
--- a/lib/libvarnish/vas.c
+++ b/lib/libvarnish/vas.c
@@ -31,6 +31,7 @@
#include "config.h"
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -39,8 +40,9 @@
static void __attribute__((__noreturn__))
VAS_Fail_default(const char *func, const char *file, int line,
- const char *cond, int err, enum vas_e kind)
+ const char *cond, enum vas_e kind)
{
+ int err = errno;
if (kind == VAS_MISSING) {
fprintf(stderr,
diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c
index 6ef7c15..ccdcab3 100644
--- a/lib/libvmod_debug/vmod_debug.c
+++ b/lib/libvmod_debug/vmod_debug.c
@@ -53,7 +53,7 @@ vmod_panic(VRT_CTX, const char *str, ...)
va_start(ap, str);
b = VRT_String(ctx->ws, "PANIC: ", str, ap);
va_end(ap);
- VAS_Fail("VCL", "", 0, b, 0, VAS_VCL);
+ VAS_Fail("VCL", "", 0, b, VAS_VCL);
}
VCL_STRING __match_proto__(td_debug_author)
More information about the varnish-commit
mailing list