From patchwork Fri Apr 19 13:59:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 237984 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 57FBE2C021C for ; Sat, 20 Apr 2013 00:09:39 +1000 (EST) Received: from localhost ([::1]:54622 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTBre-0007kN-Aa for incoming@patchwork.ozlabs.org; Fri, 19 Apr 2013 10:00:34 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTBrC-0007Sz-Lt for qemu-devel@nongnu.org; Fri, 19 Apr 2013 10:00:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UTBr7-00034g-3L for qemu-devel@nongnu.org; Fri, 19 Apr 2013 10:00:06 -0400 Received: from afflict.kos.to ([92.243.29.197]:51618) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTBr6-00033w-Ri for qemu-devel@nongnu.org; Fri, 19 Apr 2013 10:00:00 -0400 Received: from kos.to (a91-156-57-234.elisa-laajakaista.fi [91.156.57.234]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id E3DD82654C for ; Fri, 19 Apr 2013 15:59:58 +0200 (CEST) Received: from voipio (uid 1000) (envelope-from voipio@kos.to) id 5e00e7 by kos.to (DragonFly Mail Agent); Fri, 19 Apr 2013 16:59:57 +0300 From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 19 Apr 2013 16:59:54 +0300 Message-Id: X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: Petar Jovanovic Subject: [Qemu-devel] [PATCH 1/3] 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: Riku Voipio --- 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