From 181a689064792fe61edda70bb2ade55b524dbef8 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Thu, 6 Feb 2020 19:41:40 +0000 Subject: Make sure that -l always causes -w to be ignored, as documented in the man(1) manual page. This bugfix is needed to prevent the command "man -lw" from dereferencing a NULL pointer. --- main.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 61fee88f..c74a3a83 100644 --- a/main.c +++ b/main.c @@ -1,7 +1,7 @@ -/* $Id: main.c,v 1.341 2020/01/20 10:37:15 schwarze Exp $ */ +/* $Id: main.c,v 1.342 2020/02/06 19:41:40 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons - * Copyright (c) 2010-2012, 2014-2019 Ingo Schwarze + * Copyright (c) 2010-2012, 2014-2020 Ingo Schwarze * Copyright (c) 2010 Joerg Sonnenberger * * Permission to use, copy, modify, and distribute this software for any @@ -326,7 +326,8 @@ main(int argc, char *argv[]) /* Postprocess options. */ - if (outmode == OUTMODE_DEF) { + switch (outmode) { + case OUTMODE_DEF: switch (search.argmode) { case ARG_FILE: outmode = OUTMODE_ALL; @@ -339,6 +340,16 @@ main(int argc, char *argv[]) outmode = OUTMODE_LST; break; } + break; + case OUTMODE_FLN: + if (search.argmode == ARG_FILE) + outmode = OUTMODE_ALL; + break; + case OUTMODE_ALL: + break; + case OUTMODE_LST: + case OUTMODE_ONE: + abort(); } if (oarg != NULL) { -- cgit v1.2.3-56-ge451