summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/common.c b/src/common.c
index ca64c4e1d..a512b9c58 100644
--- a/src/common.c
+++ b/src/common.c
@@ -160,6 +160,31 @@ run_script(const char* script, int argc, char** argv, char** env)
/*
+ * Some older systems don't define strerror(). Provide a replacement
+ * that is good enough for our purposes.
+ */
+
+#ifdef NEED_STRERROR
+
+extern char *sys_errlist[];
+extern int sys_nerr;
+
+char* strerror(int errno)
+{
+ if(errno < 0 || errno >= sys_nerr)
+ {
+ return "unknown error";
+ }
+ else
+ {
+ return sys_errlist[errno];
+ }
+}
+
+#endif /* NEED_STRERROR */
+
+
+/*
* Local Variables:
* c-file-style: "python"
* End: