Skip to content

Commit

Permalink
su.c: s/doshell/do_interactive_shell/
Browse files Browse the repository at this point in the history
Mechanical rename distinguishing this variable from intended changes
supporting executing commands without using an interpretive shell
(i.e. no '/bin/sh -c').
  • Loading branch information
vcaputo committed May 10, 2020
1 parent 95fa2a8 commit 41985df
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/su.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static bool caller_on_console = false;
static /*@only@*/char *caller_pass;
#endif
#endif /* !USE_PAM */
static bool doshell = false;
static bool do_interactive_shell = false;
static bool fakelogin = false;
static /*@observer@*/const char *shellstr;
static /*@null@*/char *command = NULL;
Expand Down Expand Up @@ -327,11 +327,11 @@ static void prepare_pam_close_session (void)
if ( (sigaddset (&ourset, SIGTERM) != 0)
|| (sigaddset (&ourset, SIGALRM) != 0)
|| (sigaction (SIGTERM, &action, NULL) != 0)
|| ( !doshell /* handle SIGINT (Ctrl-C), SIGQUIT
* (Ctrl-\), and SIGTSTP (Ctrl-Z)
* since the child will not control
* the tty.
*/
|| (!do_interactive_shell /* handle SIGINT (Ctrl-C), SIGQUIT
* (Ctrl-\), and SIGTSTP (Ctrl-Z)
* since the child will not control
* the tty.
*/
&& ( (sigaddset (&ourset, SIGINT) != 0)
|| (sigaddset (&ourset, SIGQUIT) != 0)
|| (sigaddset (&ourset, SIGTSTP) != 0)
Expand Down Expand Up @@ -866,9 +866,9 @@ static void process_flags (int argc, char **argv)
optidx++;
}

doshell = (argc == optidx); /* any arguments remaining? */
do_interactive_shell = (argc == optidx); /* any arguments remaining? */
if (NULL != command) {
doshell = false;
do_interactive_shell = false;
}
}

Expand Down Expand Up @@ -1144,7 +1144,7 @@ int main (int argc, char **argv)

set_environment (pw);

if (!doshell) {
if (!do_interactive_shell) {
/* There is no need for a controlling terminal.
* This avoids the callee to inject commands on
* the caller's tty. */
Expand Down Expand Up @@ -1212,7 +1212,7 @@ int main (int argc, char **argv)
cp = Basename (shellstr);
}

if (!doshell) {
if (!do_interactive_shell) {
int err;
/* Position argv to the remaining arguments */
argv += optidx;
Expand Down

0 comments on commit 41985df

Please sign in to comment.