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

Radostin Stoyanov rstoyanov1 at gmail.com
Sat Nov 17 14:53:29 MSK 2018


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)
 {
 	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



More information about the CRIU mailing list