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);