From patchwork Fri Apr 19 11:33:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 237922 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C36162C01B4 for ; Fri, 19 Apr 2013 21:37:34 +1000 (EST) Received: from localhost ([::1]:49907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UT9dE-0002FP-Nt for incoming@patchwork.ozlabs.org; Fri, 19 Apr 2013 07:37:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UT9aC-0006jv-Oo for qemu-devel@nongnu.org; Fri, 19 Apr 2013 07:34:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UT9a8-0003QD-KR for qemu-devel@nongnu.org; Fri, 19 Apr 2013 07:34:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28975) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UT9a8-0003Q1-CI for qemu-devel@nongnu.org; Fri, 19 Apr 2013 07:34:20 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3JBYIvQ006278 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 19 Apr 2013 07:34:18 -0400 Received: from localhost (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r3JBYGAY020105; Fri, 19 Apr 2013 07:34:17 -0400 From: Stefan Hajnoczi To: Date: Fri, 19 Apr 2013 13:33:58 +0200 Message-Id: <1366371241-23430-6-git-send-email-stefanha@redhat.com> In-Reply-To: <1366371241-23430-1-git-send-email-stefanha@redhat.com> References: <1366371241-23430-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Anthony Liguori , Petar Jovanovic , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 5/8] linux-user: change do_semop to return target errno when unsuccessful X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Petar Jovanovic do_semop() is called from two places, and one of these fails to convert return error to target errno when semop fails. This patch changes the function to always return target errno in case of an unsuccessful call. Signed-off-by: Petar Jovanovic Reviewed-by: Peter Maydell Signed-off-by: Stefan Hajnoczi --- linux-user/syscall.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 1f07621..d6d2050 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -2764,7 +2764,7 @@ static inline abi_long do_semop(int semid, abi_long ptr, unsigned nsops) if (target_to_host_sembuf(sops, ptr, nsops)) return -TARGET_EFAULT; - return semop(semid, sops, nsops); + return get_errno(semop(semid, sops, nsops)); } struct target_msqid_ds @@ -6957,7 +6957,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, #endif #ifdef TARGET_NR_semop case TARGET_NR_semop: - ret = get_errno(do_semop(arg1, arg2, arg3)); + ret = do_semop(arg1, arg2, arg3); break; #endif #ifdef TARGET_NR_semctl