[CRIU] [PATCHv2 3/3] tty: Make unlock_pty() inline void

Andrei Vagin avagin at gmail.com
Wed Jan 9 10:09:26 MSK 2019


On Sat, Nov 17, 2018 at 11:53:29AM +0000, Radostin Stoyanov wrote:
> The return value of unlock_pty() is not needed because if the unlock
> fails then futher operations on locked entry will fail as well.
> unlock_pty() will only yield the error message.
> 
> Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
> ---
>  criu/tty.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/criu/tty.c b/criu/tty.c
> index 38e1cab3..fe126f18 100644
> --- a/criu/tty.c
> +++ b/criu/tty.c
> @@ -655,7 +655,7 @@ static int pty_open_ptmx_index(struct file_desc *d, struct tty_info *info, int f
>  					open_tty_reg, d, path_from_reg(d));
>  }
>  
> -static int unlock_pty(int fd)
> +static void inline unlock_pty(int fd)

What is the benefit?

An inline function can return int...

>  {
>  	const int lock = 0;
>  
> @@ -664,12 +664,8 @@ static int unlock_pty(int fd)
>  	 * by kernel and we need to unlock it to be
>  	 * able to connect slave peer.
>  	 */
> -	if (ioctl(fd, TIOCSPTLCK, &lock)) {
> +	if (ioctl(fd, TIOCSPTLCK, &lock))
>  		pr_err("Unable to unlock pty device via y%d\n", fd);
> -		return -1;
> -	}
> -
> -	return 0;
>  }
>  
>  static int lock_pty(int fd)
> -- 
> 2.17.2
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list