Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/makemandb Don't crash if we have a missing section.
details: https://anonhg.NetBSD.org/src/rev/91ad908689ca
branches: trunk
changeset: 343287:91ad908689ca
user: christos <christos%NetBSD.org@localhost>
date: Thu Jan 28 03:32:29 2016 +0000
description:
Don't crash if we have a missing section.
diffstat:
usr.sbin/makemandb/makemandb.c | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diffs (43 lines):
diff -r 9c5c90a96e45 -r 91ad908689ca usr.sbin/makemandb/makemandb.c
--- a/usr.sbin/makemandb/makemandb.c Thu Jan 28 01:09:56 2016 +0000
+++ b/usr.sbin/makemandb/makemandb.c Thu Jan 28 03:32:29 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: makemandb.c,v 1.30 2015/12/18 14:30:16 christos Exp $ */
+/* $NetBSD: makemandb.c,v 1.31 2016/01/28 03:32:29 christos Exp $ */
/*
* Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>
* Copyright (c) 2011 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
@@ -17,7 +17,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: makemandb.c,v 1.30 2015/12/18 14:30:16 christos Exp $");
+__RCSID("$NetBSD: makemandb.c,v 1.31 2016/01/28 03:32:29 christos Exp $");
#include <sys/stat.h>
#include <sys/types.h>
@@ -945,11 +945,21 @@
{
if (md) {
const struct mdoc_meta *md_meta = mdoc_meta(md);
- rec->section[0] = md_meta->msec[0];
+ if (md_meta->msec == NULL) {
+ rec->section[0] = '?';
+ } else
+ rec->section[0] = md_meta->msec[0];
} else if (m) {
const struct man_meta *m_meta = man_meta(m);
- rec->section[0] = m_meta->msec[0];
- }
+ if (m_meta->msec == NULL)
+ rec->section[0] = '?';
+ else
+ rec->section[0] = m_meta->msec[0];
+ } else
+ return;
+
+ if (rec->section[0] == '?' && mflags.verbosity == 2)
+ warnx("%s: Missing section number", rec->file_path);
}
/*
Home |
Main Index |
Thread Index |
Old Index