From cbff87fe1737d477f87054effe08c8c5f490b6e3 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 4 Aug 2018 16:45:16 -0700 Subject: [PATCH] Minor cleanup and const correctness --- src/postfork.cpp | 2 +- src/postfork.h | 2 +- src/proc.cpp | 2 +- src/proc.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/postfork.cpp b/src/postfork.cpp index 93281b28a..dd3b1924e 100644 --- a/src/postfork.cpp +++ b/src/postfork.cpp @@ -133,7 +133,7 @@ bool set_child_group(job_t *j, pid_t child_pid) { return true; } -bool maybe_assign_terminal(job_t *j) { +bool maybe_assign_terminal(const job_t *j) { assert(j->pgid > 1 && "maybe_assign_terminal() called on job with invalid pgid!"); if (j->get_flag(JOB_TERMINAL) && j->get_flag(JOB_FOREGROUND)) { //!OCLINT(early exit) diff --git a/src/postfork.h b/src/postfork.h index e2c102c6a..f7cfe080d 100644 --- a/src/postfork.h +++ b/src/postfork.h @@ -20,7 +20,7 @@ class process_t; bool set_child_group(job_t *j, pid_t child_pid); // called by parent bool child_set_group(job_t *j, process_t *p); // called by child -bool maybe_assign_terminal(job_t *j); +bool maybe_assign_terminal(const job_t *j); /// Initialize a new child process. This should be called right away after forking in the child /// process. If job control is enabled for this job, the process is put in the process group of the diff --git a/src/proc.cpp b/src/proc.cpp index 9974bf686..280f1a74d 100644 --- a/src/proc.cpp +++ b/src/proc.cpp @@ -779,7 +779,7 @@ static void read_try(job_t *j) { /// \param j The job to give the terminal to. /// \param cont If this variable is set, we are giving back control to a job that has previously /// been stopped. In that case, we need to set the terminal attributes to those saved in the job. -bool terminal_give_to_job(job_t *j, int cont) { +bool terminal_give_to_job(const job_t *j, bool cont) { errno = 0; if (j->pgid == 0) { debug(2, "terminal_give_to_job() returning early due to no process group"); diff --git a/src/proc.h b/src/proc.h index 8ed88e26f..66dc3addc 100644 --- a/src/proc.h +++ b/src/proc.h @@ -372,4 +372,4 @@ pid_t proc_wait_any(); #endif -bool terminal_give_to_job(job_t *j, int cont); +bool terminal_give_to_job(const job_t *j, bool cont);