From 775b775240d09fe665efaecf2432d590567e68ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bert=20M=C3=BCnnich?= Date: Fri, 27 Oct 2017 19:30:09 +0200 Subject: Fix exit value for -e with failed backquote or pipeline This fixes rakitzis/rc issue #40. Both cases suffered from a misconception of statprint() in which the necessary check for -e happens. The checked status value gets passed to statprint() as an argument but the corresponding value passed to rc_exit() in case the status is non-zero comes from getstatus(), which requires that the checked status is written to statuses[] first. For pipelines this happened in the wrong order and for backquotes the status value was not put into statuses[] at all. Making statprint() a static helper function prevents this mistake by only leaving the setstatus family of functions to handle status codes. --- rc.h | 1 - 1 file changed, 1 deletion(-) (limited to 'rc.h') diff --git a/rc.h b/rc.h index 2912e60..68d338d 100644 --- a/rc.h +++ b/rc.h @@ -347,7 +347,6 @@ extern void set(bool); extern void setstatus(pid_t, int); extern List *sgetstatus(void); extern void setpipestatus(int [], int); -extern void statprint(pid_t, int); extern void ssetstatus(char **); extern char *strstatus(int s); -- cgit v1.2.3