From a5bf16c0928cb4044b082f9cf6f44f9bb3998824 Mon Sep 17 00:00:00 2001 From: David Levine Date: Sat, 17 Jun 2017 11:01:32 -0400 Subject: [PATCH] Show display program name and arguments in error message if it fails. --- uip/mhshowsbr.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 11ec02b3..29c7c435 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -499,10 +499,19 @@ show_content_aux2 (CT ct, int alternate, char *cracked, char *buffer, default: { int status; + char *display_prog = NULL; - arglist_free(file, vec); + if (vecp > 2 && vec[2][0] != '\0') { + /* Copy the real display program name. This relies on the + specific construction of vec[] by argsplit(). */ + display_prog = mh_xstrdup(vec[2]); + } + + arglist_free(file, vec); + + pidcheck ((status = pidXwait (child_id, display_prog))); - pidcheck ((status = pidXwait (child_id, NULL))); + mh_xfree(display_prog); if (fd != NOTOK) (*ct->c_ceclosefnx) (ct); -- 2.48.1