[PATCH] getty: remove the statement of pid and sid comparison

Isaac Dunham ibid.ag at gmail.com
Sat May 10 04:34:15 UTC 2014


On Sat, May 10, 2014 at 10:17:13AM +0800, Zhenhua Luo wrote:
> when setsid failed, the pid and sid doesn't equal, so remove following
> condition statement.
>     if (getsid(0) != pid)
> 
<snip>
> 
> Fix following runtime issue of getty:
> root at p1025:~# getty 115200 /dev/ttyQE1
> getty: setsid: Operation not permitted
> 
> Signed-off-by: Zhenhua Luo <zhenhua.luo at freescale.com>
> ---
>  loginutils/getty.c | 9 ---------
>  1 file changed, 9 deletions(-)
> 
> diff --git a/loginutils/getty.c b/loginutils/getty.c
> index 0f060ae..6bfdf43 100644
> --- a/loginutils/getty.c
> +++ b/loginutils/getty.c
> @@ -548,15 +548,6 @@ int getty_main(int argc UNUSED_PARAM, char **argv)
>  		 * a session leader - which is quite possible for getty!
>  		 */
>  		pid = getpid();
> -		if (getsid(0) != pid) {
> -			//for debugging:
> -			//bb_perror_msg_and_die("setsid failed:"
> -			//	" pid %d ppid %d"
> -			//	" sid %d pgid %d",
> -			//	pid, getppid(),
> -			//	getsid(0), getpgid(0));
> -			bb_perror_msg_and_die("setsid");
> -		}
>  		/* Looks like we are already a session leader.
>  		 * In this case (setsid failed) we may still have ctty,
>  		 * and it may be different from tty we need to control!
> -- 
> 1.9.1

You might want to read the comments surrounding this.
If I understand correctly, the behavior you're "fixing" is the intended
behavior.
And even if it weren't correct, the comments would need to be updated.

Thanks,
Isaac Dunham


More information about the busybox mailing list