aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/compat_sqlite3_errstr.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-08-05 12:50:52 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-08-05 12:50:52 +0000
commit99660883f075bacb16d7284523a36f8e6c69a665 (patch)
tree424e175eb4f2af8a990f03bc597bc819f6642bec /compat_sqlite3_errstr.c
parent3269dd3e704bc9880455b95bb67a490b5b503216 (diff)
downloadmandoc-99660883f075bacb16d7284523a36f8e6c69a665.tar.gz
mandoc-99660883f075bacb16d7284523a36f8e6c69a665.tar.zst
mandoc-99660883f075bacb16d7284523a36f8e6c69a665.zip
Since old SQLite versions do not have sqlite3_errstr(),
provide a dummy fallback implementation. Do not bother to decode the error, SQLite error codes are not useful enough for that to be worthwhile. Note that using sqlite3_errmsg(db) would be a bad idea: On malloc() failure, db is NULL, which would cause a segfault. Issue noticed by kristaps@.
Diffstat (limited to 'compat_sqlite3_errstr.c')
-rw-r--r--compat_sqlite3_errstr.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/compat_sqlite3_errstr.c b/compat_sqlite3_errstr.c
new file mode 100644
index 00000000..b8d6eb58
--- /dev/null
+++ b/compat_sqlite3_errstr.c
@@ -0,0 +1,18 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_SQLITE3_ERRSTR
+
+int dummy;
+
+#else
+
+const char *
+sqlite3_errstr(int rc)
+{
+
+ return(rc ? "unknown error" : "not an error");
+}
+
+#endif