From patchwork Thu Nov 25 10:07:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mi Jinlong X-Patchwork-Id: 356492 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAPA422x026467 for ; Thu, 25 Nov 2010 10:04:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751374Ab0KYKEA (ORCPT ); Thu, 25 Nov 2010 05:04:00 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:57012 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1750997Ab0KYKD7 (ORCPT ); Thu, 25 Nov 2010 05:03:59 -0500 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 6CA68170E96; Thu, 25 Nov 2010 18:03:59 +0800 (CST) Received: from mailserver.fnst.cn.fujitus.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id oAP9xRr1014058; Thu, 25 Nov 2010 17:59:27 +0800 Received: from [127.0.0.1] ([10.167.225.24]) by mailserver.fnst.cn.fujitus.com (Lotus Domino Release 8.5.1FP4) with ESMTP id 2010112518041520-101362 ; Thu, 25 Nov 2010 18:04:15 +0800 Message-ID: <4CEE357D.2030007@cn.fujitsu.com> Date: Thu, 25 Nov 2010 18:07:57 +0800 From: Mi Jinlong User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Steve Dickson CC: NFSv3 list Subject: [PATCH] mount: avoid po_destroy to modify errno what we really want X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2010-11-25 18:04:15, Serialize by Router on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2010-11-25 18:04:15, Serialize complete at 2010-11-25 18:04:15 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 25 Nov 2010 10:04:02 +0000 (UTC) diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 50a1a2a..d554877 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -592,7 +592,7 @@ static int nfs_do_mount_v3v2(struct nfsmount_info *mi, struct sockaddr *sap, socklen_t salen) { struct mount_options *options = po_dup(mi->options); - int result = 0; + int result = 0, save = 0; if (!options) { errno = ENOMEM; @@ -637,7 +637,9 @@ static int nfs_do_mount_v3v2(struct nfsmount_info *mi, result = nfs_sys_mount(mi, options); out_fail: + save = errno; po_destroy(options); + errno = save; return result; } @@ -673,7 +675,7 @@ static int nfs_do_mount_v4(struct nfsmount_info *mi, struct sockaddr *sap, socklen_t salen) { struct mount_options *options = po_dup(mi->options); - int result = 0; + int result = 0, save = 0; if (!options) { errno = ENOMEM; @@ -724,7 +726,9 @@ static int nfs_do_mount_v4(struct nfsmount_info *mi, result = nfs_sys_mount(mi, options); out_fail: + save = errno; po_destroy(options); + errno = save; return result; }