diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2015-11-26 07:42:11 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2015-11-26 07:42:11 +0000 |
commit | cd024781e6da76dda541a980fc161f031b33e300 (patch) | |
tree | 1ca172e4da4970d0b353260c606aed48f50cad6f /mansearch.c | |
parent | 8d3579c89a011ed5df5b09b7d1bbaead6d7d9895 (diff) | |
download | mandoc-cd024781e6da76dda541a980fc161f031b33e300.tar.gz |
No point in trying to go on when elementary database operations
like preparing queries or binding variables fail; that won't yield
useful results anyway but may generate huge pointless error messages.
Issue reported by deraadt@.
Diffstat (limited to 'mansearch.c')
-rw-r--r-- | mansearch.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/mansearch.c b/mansearch.c index 37b1e6b3..0db8edbf 100644 --- a/mansearch.c +++ b/mansearch.c @@ -54,17 +54,17 @@ extern const char *const mansearch_keynames[]; #define SQL_BIND_TEXT(_db, _s, _i, _v) \ do { if (SQLITE_OK != sqlite3_bind_text \ ((_s), (_i)++, (_v), -1, SQLITE_STATIC)) \ - warnx("%s", sqlite3_errmsg((_db))); \ + errx((int)MANDOCLEVEL_SYSERR, "%s", sqlite3_errmsg((_db))); \ } while (0) #define SQL_BIND_INT64(_db, _s, _i, _v) \ do { if (SQLITE_OK != sqlite3_bind_int64 \ ((_s), (_i)++, (_v))) \ - warnx("%s", sqlite3_errmsg((_db))); \ + errx((int)MANDOCLEVEL_SYSERR, "%s", sqlite3_errmsg((_db))); \ } while (0) #define SQL_BIND_BLOB(_db, _s, _i, _v) \ do { if (SQLITE_OK != sqlite3_bind_blob \ ((_s), (_i)++, (&_v), sizeof(_v), SQLITE_STATIC)) \ - warnx("%s", sqlite3_errmsg((_db))); \ + errx((int)MANDOCLEVEL_SYSERR, "%s", sqlite3_errmsg((_db))); \ } while (0) struct expr { @@ -262,7 +262,8 @@ mansearch(const struct mansearch *search, j = 1; c = sqlite3_prepare_v2(db, sql, -1, &s, NULL); if (SQLITE_OK != c) - warnx("%s", sqlite3_errmsg(db)); + errx((int)MANDOCLEVEL_SYSERR, + "%s", sqlite3_errmsg(db)); for (ep = e; NULL != ep; ep = ep->next) { if (NULL == ep->substr) { @@ -312,14 +313,16 @@ mansearch(const struct mansearch *search, "WHERE pageid=? ORDER BY sec, arch, name", -1, &s, NULL); if (SQLITE_OK != c) - warnx("%s", sqlite3_errmsg(db)); + errx((int)MANDOCLEVEL_SYSERR, + "%s", sqlite3_errmsg(db)); c = sqlite3_prepare_v2(db, "SELECT bits, key, pageid FROM keys " "WHERE pageid=? AND bits & ?", -1, &s2, NULL); if (SQLITE_OK != c) - warnx("%s", sqlite3_errmsg(db)); + errx((int)MANDOCLEVEL_SYSERR, + "%s", sqlite3_errmsg(db)); for (mp = ohash_first(&htab, &idx); NULL != mp; |