From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 2E4A27F8C for ; Thu, 6 Nov 2014 03:31:34 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 05 Nov 2014 18:40:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="412185753" Received: from pgsmsx103.gar.corp.intel.com ([10.221.44.82]) by FMSMGA003.fm.intel.com with ESMTP; 05 Nov 2014 18:32:25 -0800 Received: from pgsmsx106.gar.corp.intel.com (10.221.44.98) by PGSMSX103.gar.corp.intel.com (10.221.44.82) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 6 Nov 2014 10:38:33 +0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by pgsmsx106.gar.corp.intel.com (10.221.44.98) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 6 Nov 2014 10:38:32 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.202]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.13]) with mapi id 14.03.0195.001; Thu, 6 Nov 2014 10:38:31 +0800 From: "Xie, Huawei" To: "Ouyang, Changchun" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] librte_vhost: Fix the path test issue Thread-Index: AQHP9z5ZPyMYv+0Ta06WGuZbD1h80pxS5i+w Date: Thu, 6 Nov 2014 02:38:31 +0000 Message-ID: References: <1415002313-15661-1-git-send-email-changchun.ouyang@intel.com> In-Reply-To: <1415002313-15661-1-git-send-email-changchun.ouyang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] librte_vhost: Fix the path test issue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Nov 2014 02:31:34 -0000 > path =3D realpath(memfile, resolved_path); > - if (path =3D=3D NULL) { > + if ((path =3D=3D NULL) && (strlen(resolved_path) =3D=3D 0)) { > RTE_LOG(ERR, VHOST_CONFIG, > "(%"PRIu64") Failed to resolve fd directory\n", > dev->device_fh); Changchun: For some strange file, according to API description, we shouldn't check res= olved_path as it is undefined. To make the loop go on, we could use "continue" when we detect path is NULL= . RETURN VALUE If there is no error, realpath() returns a pointer to the resolved_p= ath. Otherwise it returns a NULL pointer, and the contents of the array r= esolved_path are undefined, and errno is set to indicate the error.