From: David Levine Date: Sat, 17 Jun 2017 15:01:32 +0000 (-0400) Subject: Show display program name and arguments in error message if it fails. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/a5bf16c0928cb4044b082f9cf6f44f9bb3998824?ds=sidebyside Show display program name and arguments in error message if it fails. --- 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);