From 9ef16b96be75b66de146889e69c4b0130a151f7c Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 17 Mar 2015 07:33:07 +0000 Subject: When the user exits the pager before the pager has drained all input from man(1), man(1) dies from SIGPIPE. Exiting man(1) is fine in this case, generating more output would be pointless, but without handling SIGPIPE, the exit code from man(1) was wrong and csh(1) printed an ugly message "Broken pipe". Fix this by handling SIGPIPE explicitly. Issue noticed by deraadt@. --- read.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'read.c') diff --git a/read.c b/read.c index 471d4150..397e6cd7 100644 --- a/read.c +++ b/read.c @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.131 2015/03/11 13:05:20 schwarze Exp $ */ +/* $Id: read.c,v 1.132 2015/03/17 07:33:07 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2015 Ingo Schwarze @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -846,6 +847,7 @@ mparse_open(struct mparse *curp, int *fd, const char *file) perror("dup"); exit((int)MANDOCLEVEL_SYSERR); } + signal(SIGPIPE, SIG_DFL); execlp("gunzip", "gunzip", "-c", file, NULL); perror("exec"); exit((int)MANDOCLEVEL_SYSERR); -- cgit v1.2.3-56-ge451