summaryrefslogtreecommitdiff
path: root/usr.sbin/makemandb
diff options
context:
space:
mode:
authorabhinav <abhinav@NetBSD.org>2019-08-18 09:14:30 +0000
committerabhinav <abhinav@NetBSD.org>2019-08-18 09:14:30 +0000
commit3ec4cb362f36addff3aa87ecb3a8dd0ab2ddc554 (patch)
tree359f8eed6dfeedde91bfcde53464068d923f8862 /usr.sbin/makemandb
parent7fd5edfd415d5bf51c3f24cadb2b6f2c3d3292bf (diff)
PR bin/54343: We want the callback_args.machine to be NULL if it is not present in the DB.
The previous commit fixed the problem of allowing apropos to not crash and produce output even if the database is missing values for certain mandatory fields, such as name, section etc. Normally we don't expect those values to be missing in the database but in case of parsing errors it can happen. However, the machine architecture is an optional field since not all man pages are hardware specific so that should be allowed to be set to NULL if not present in the database.
Diffstat (limited to 'usr.sbin/makemandb')
-rw-r--r--usr.sbin/makemandb/apropos-utils.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/makemandb/apropos-utils.c b/usr.sbin/makemandb/apropos-utils.c
index 29aaaec2c13..a1d94930d95 100644
--- a/usr.sbin/makemandb/apropos-utils.c
+++ b/usr.sbin/makemandb/apropos-utils.c
@@ -1,4 +1,4 @@
-/* $NetBSD: apropos-utils.c,v 1.46 2019/08/15 10:29:07 christos Exp $ */
+/* $NetBSD: apropos-utils.c,v 1.47 2019/08/18 09:14:30 abhinav Exp $ */
/*-
* Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com>
* All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: apropos-utils.c,v 1.46 2019/08/15 10:29:07 christos Exp $");
+__RCSID("$NetBSD: apropos-utils.c,v 1.47 2019/08/18 09:14:30 abhinav Exp $");
#include <sys/queue.h>
#include <sys/stat.h>
@@ -705,7 +705,7 @@ execute_search_query(sqlite3 *db, char *query, query_args *args)
callback_args.section = get_stmt_col_text(stmt, 0);
name_temp = get_stmt_col_text(stmt, 1);
callback_args.name_desc = get_stmt_col_text(stmt, 2);
- callback_args.machine = get_stmt_col_text(stmt, 3);
+ callback_args.machine = (const char *) sqlite3_column_text(stmt, 3);
if (!args->legacy) {
callback_args.snippet = get_stmt_col_text(stmt, 4);
callback_args.snippet_length =