[PATCH] checkpoint: use syscall_get_error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



restore_retval() uses the result of syscall_get_return_value() to
determine whether a syscall is to return an error.  This isn't
portable and doesn't work on powerpc.  Instead, use
syscall_get_error(), which encapsulates the arch-specific logic for
determining syscall error state.

Signed-off-by: Nathan Lynch <ntl@xxxxxxxxx>
---
 checkpoint/restart.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/checkpoint/restart.c b/checkpoint/restart.c
index 0891952..696e4a2 100644
--- a/checkpoint/restart.c
+++ b/checkpoint/restart.c
@@ -1316,7 +1316,8 @@ static int do_restore_coord(struct ckpt_ctx *ctx, pid_t pid)
 static long restore_retval(void)
 {
 	struct pt_regs *regs = task_pt_regs(current);
-	long ret;
+	long syscall_err;
+	long syscall_nr;
 
 	/*
 	 * For the restart, we entered the kernel via sys_restart(),
@@ -1352,13 +1353,14 @@ static long restore_retval(void)
 	 */
 
 	/* needed for all 3 cases: get old value/error/retval */
-	ret = syscall_get_return_value(current, regs);
+	syscall_nr = syscall_get_nr(current, regs);
+	syscall_err = syscall_get_error(current, regs);
 
-	/* if from a syscall and returning error, kick in signal handlig */
-	if (syscall_get_nr(current, regs) >= 0 && ret < 0)
+	/* if from a syscall and returning error, kick in signal handling */
+	if (syscall_nr >= 0 && syscall_err != 0)
 		set_tsk_thread_flag(current, TIF_SIGPENDING);
 
-	return ret;
+	return syscall_get_return_value(current, regs);
 }
 
 long do_restart(struct ckpt_ctx *ctx, pid_t pid, unsigned long flags)
-- 
1.6.0.6

_______________________________________________
Containers mailing list
Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/containers

[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux