From patchwork Tue Sep 7 05:31:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 44879 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 18270385383E for ; Tue, 7 Sep 2021 05:32:12 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by sourceware.org (Postfix) with ESMTPS id 103D53858415 for ; Tue, 7 Sep 2021 05:32:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 103D53858415 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=flygoat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=flygoat.com Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 2F2795C00F3; Tue, 7 Sep 2021 01:31:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 07 Sep 2021 01:31:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm3; bh=m8z0H6rS9JCg4y2rqrj2IK56hZ btZyJjNEm5g9dzUVc=; b=UP7rimOB57uUWM6fI5RTsu016pzOtJu84+HX/WOvVX rUsu+TOMMJQ19Dc4Xqs/cMBRZ09AOO+vrafnENbzTJ0nHjMhDy22lnOBs/wA+l7q x0eCpYsKIug/7eEIfxqi7s19Sh3DxqISIUC2Y3dPk5/DM0RyK2umitdSUiMumJLf DQALGLEGiFfguhuDPIIw2H6P+LxN4AZUaXY8auVLAaqLkHowrCkwOkVdcYl/aSEt d0MlDYrlYPj8BmNzxvNHIpiwDVAwdY8AaQOpslaD3ppN4T0OPdBF4ubKkiZP7T39 MMZKHBYeh3CrHz7NpXGg5WdAMoDn1vFch/tmb4kmpAPw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=m8z0H6rS9JCg4y2rq rj2IK56hZbtZyJjNEm5g9dzUVc=; b=JjBQH32wV1B+FRr24/tu3pnqU064JcyQN F2YkkpTqi8AvwIKi/kW8C8uyvIRAdyitdSmDq4RSmfLBADW6PmCd+FySSDl+GYGW q/EEPkp9cfpp5MAFMtcEHy0GGy0qehhvaczkRLPOqBQf0h1QS4l9l8Kz3zxeoOeQ DV2f6yWG8X+V1us8VKLWzLyswjX8qbDcla4xz0GUZOeQAii8UB9Gl6Hz8L+L6oK3 G/GEIrWQ/7ofBwxNR7m4+ZBQsS5N7Hz2JNIYxRD8WAegvHXsgg0iURHOaNqV9123 VfY37m+3UvC3kqD8UMG6ZVpg92EZDswhpJwUPT8DSNXxRVUZNJswQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudefgedgleefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgggfestdekredtre dttdenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehf lhihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpefhjedtkedtueehtdeifeetke evffetjeetfeegkeevgefftedvudfgleeihfdtudenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorg htrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 7 Sep 2021 01:31:55 -0400 (EDT) From: Jiaxun Yang To: libc-alpha@sourceware.org Subject: [PATCH] MIPS: Setup errno for {f,l,}xstat Date: Tue, 7 Sep 2021 13:31:42 +0800 Message-Id: <20210907053142.1774-1-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: syq@debian.org, xry111@mengyan1223.wang, Jiaxun Yang Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" {f,l,}xstat stub for MIPS is using INTERNAL_SYSCALL to do xstat syscall for glibc ver, However it leaves errno untouched and thus giving bad errno output. Setup errno properly when syscall returns non-zero. Signed-off-by: Jiaxun Yang Reviewed-by: Adhemerval Zanella --- sysdeps/unix/sysv/linux/mips/fxstat.c | 4 +++- sysdeps/unix/sysv/linux/mips/lxstat.c | 4 +++- sysdeps/unix/sysv/linux/mips/xstat.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sysdeps/unix/sysv/linux/mips/fxstat.c b/sysdeps/unix/sysv/linux/mips/fxstat.c index 11511d30b3..6d2750adcd 100644 --- a/sysdeps/unix/sysv/linux/mips/fxstat.c +++ b/sysdeps/unix/sysv/linux/mips/fxstat.c @@ -35,7 +35,9 @@ __fxstat (int vers, int fd, struct stat *buf) { struct kernel_stat kbuf; int r = INTERNAL_SYSCALL_CALL (fstat, fd, &kbuf); - return r ?: __xstat_conv (vers, &kbuf, buf); + if (r == 0) + return __xstat_conv (vers, &kbuf, buf); + return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r); } } } diff --git a/sysdeps/unix/sysv/linux/mips/lxstat.c b/sysdeps/unix/sysv/linux/mips/lxstat.c index 871fb6c6c5..77656be276 100644 --- a/sysdeps/unix/sysv/linux/mips/lxstat.c +++ b/sysdeps/unix/sysv/linux/mips/lxstat.c @@ -35,7 +35,9 @@ __lxstat (int vers, const char *name, struct stat *buf) { struct kernel_stat kbuf; int r = INTERNAL_SYSCALL_CALL (lstat, name, &kbuf); - return r ?: __xstat_conv (vers, &kbuf, buf); + if (r == 0) + return __xstat_conv (vers, &kbuf, buf); + return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r); } } } diff --git a/sysdeps/unix/sysv/linux/mips/xstat.c b/sysdeps/unix/sysv/linux/mips/xstat.c index 9d810b6f65..4c6fabb502 100644 --- a/sysdeps/unix/sysv/linux/mips/xstat.c +++ b/sysdeps/unix/sysv/linux/mips/xstat.c @@ -35,7 +35,9 @@ __xstat (int vers, const char *name, struct stat *buf) { struct kernel_stat kbuf; int r = INTERNAL_SYSCALL_CALL (stat, name, &kbuf); - return r ?: __xstat_conv (vers, &kbuf, buf); + if (r == 0) + return __xstat_conv (vers, &kbuf, buf); + return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r); } } }