Module Name: src Committed By: abhinav Date: Sun Aug 18 09:14:30 UTC 2019
Modified Files: src/usr.sbin/makemandb: apropos-utils.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/usr.sbin/makemandb/apropos-utils.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.sbin/makemandb/apropos-utils.c diff -u src/usr.sbin/makemandb/apropos-utils.c:1.46 src/usr.sbin/makemandb/apropos-utils.c:1.47 --- src/usr.sbin/makemandb/apropos-utils.c:1.46 Thu Aug 15 10:29:07 2019 +++ src/usr.sbin/makemandb/apropos-utils.c Sun Aug 18 09:14:30 2019 @@ -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.upadh...@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 * 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 =