]> diplodocus.org Git - nmh/commitdiff
Show display program name and arguments in error message if it fails.
authorDavid Levine <levinedl@acm.org>
Sat, 17 Jun 2017 15:01:32 +0000 (11:01 -0400)
committerDavid Levine <levinedl@acm.org>
Sat, 17 Jun 2017 15:01:32 +0000 (11:01 -0400)
uip/mhshowsbr.c

index 11ec02b..29c7c43 100644 (file)
@@ -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);