ash: move TRACE statement in evalcommand()
authorRon Yorston <rmy@pobox.com>
Fri, 21 Feb 2020 16:16:56 +0000 (16:16 +0000)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 24 Feb 2020 11:52:41 +0000 (12:52 +0100)
Following recent work on evalcommand() a TRACE statement to report
the status of a forked command was left in the wrong place.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c

index bf6a86d3dbf13683921858ef950f498d34aa2a2e..03864c6679ba52ac964ef1fd894312034e9a05e6 100644 (file)
@@ -10392,7 +10392,6 @@ evalcommand(union node *cmd, int flags)
                        jp = makejob(/*cmd,*/ 1);
                        if (forkshell(jp, cmd, FORK_FG) != 0) {
                                /* parent */
-                               TRACE(("forked child exited with %d\n", status));
                                break;
                        }
                        /* child */
@@ -10418,6 +10417,8 @@ evalcommand(union node *cmd, int flags)
        } /* switch */
 
        status = waitforjob(jp);
+       if (jp)
+               TRACE(("forked child exited with %d\n", status));
        FORCE_INT_ON;
 
  out: