A few guards are missing, with this diff ksh compiles cleanly with JOBS
undefined.

Found while looking for undesired changes after working on job control.

Feedback?

diff --git a/bin/ksh/jobs.c b/bin/ksh/jobs.c
index 53858a37d26..7e29c2f38b8 100644
--- a/bin/ksh/jobs.c
+++ b/bin/ksh/jobs.c
@@ -201,6 +201,7 @@ j_suspend(void)
 {
        struct sigaction sa, osa;
 
+#ifdef JOBS
        /* Restore tty and pgrp. */
        if (ttypgrp_ok) {
                tcsetattr(tty_fd, TCSADRAIN, &tty_state);
@@ -218,6 +219,7 @@ j_suspend(void)
                        }
                }
        }
+#endif /* JOBS */
 
        /* Suspend the shell. */
        memset(&sa, 0, sizeof(sa));
@@ -228,6 +230,7 @@ j_suspend(void)
 
        /* Back from suspend, reset signals, pgrp and tty. */
        sigaction(SIGTSTP, &osa, NULL);
+#ifdef JOBS
        if (ttypgrp_ok) {
                if (restore_ttypgrp >= 0) {
                        if (setpgid(0, kshpid) < 0) {
@@ -246,6 +249,7 @@ j_suspend(void)
                }
                tty_init(true);
        }
+#endif /* JOBS */
 }
 
 /* job cleanup before shell exit */
@@ -1050,10 +1054,10 @@ j_waitj(Job *j,
        j->flags &= ~(JF_WAITING|JF_W_ASYNCNOTIFY);
 
        if (j->flags & JF_FG) {
-               int     status;
-
                j->flags &= ~JF_FG;
 #ifdef JOBS
+               int     status;
+
                if (Flag(FMONITOR) && ttypgrp_ok && j->pgrp) {
                        /*
                         * Save the tty's current pgrp so it can be restored

Reply via email to