summaryrefslogtreecommitdiff
path: root/strerror_override.c
diff options
context:
space:
mode:
authorEric Haszlakiewicz <erh+git@nimenees.com>2017-07-15 07:12:44 -0700
committerEric Haszlakiewicz <erh+git@nimenees.com>2017-07-15 07:12:44 -0700
commitfcad0ec015c1275e7231ee4582bc78b89a2e96da (patch)
tree935ef60d611d4ab7f5962cf53a80709c476f536c /strerror_override.c
parent730ab7b019c4367fc29d6c55a3fd7f2fe793cf84 (diff)
downloadjson-c-fcad0ec015c1275e7231ee4582bc78b89a2e96da.tar.gz
PR #336: since we can't use function overriding (due to problems with it on
OSX) always include the _json_c_strerror function but only enable it with a flag during tests.
Diffstat (limited to 'strerror_override.c')
-rw-r--r--strerror_override.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/strerror_override.c b/strerror_override.c
index 6cad0c0..ccabe97 100644
--- a/strerror_override.c
+++ b/strerror_override.c
@@ -1,3 +1,4 @@
+#define STERROR_OVERRIDE_IMPL 1
#include "strerror_override.h"
/*
@@ -52,6 +53,9 @@ static struct {
{ 0, (char *)0 }
};
+// Enabled during tests
+int _json_c_strerror_enable = 0;
+
#define PREFIX "ERRNO="
static char errno_buf[128] = PREFIX;
char *_json_c_strerror(int errno_in)
@@ -60,6 +64,9 @@ char *_json_c_strerror(int errno_in)
char digbuf[20];
int ii, jj;
+ if (!_json_c_strerror_enable)
+ return strerror(errno_in);
+
// Avoid standard functions, so we don't need to include any
// headers, or guess at signatures.