From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Vm2gr-0001TV-KR for ltp-list@lists.sourceforge.net; Thu, 28 Nov 2013 14:35:37 +0000 Date: Thu, 28 Nov 2013 15:35:05 +0100 From: chrubis@suse.cz Message-ID: <20131128143504.GF19263@rei.Home> References: <528DE213.1030106@cn.fujitsu.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <528DE213.1030106@cn.fujitsu.com> Subject: Re: [LTP] [PATCH v3] dup3(2): add EINVAL error number test List-Id: Linux Test Project General Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ltp-list-bounces@lists.sourceforge.net To: Xiaoguang Wang Cc: ltp-list@lists.sourceforge.net Hi! > +static void cleanup(void) > +{ > + TEST_CLEANUP; > + > + SAFE_CLOSE(cleanup, old_fd); Take care not to call cleanup() from within a cleanup() If the close() here will fail, the cleanup will be called, then the close() will fail and the cleanup will be called... untill the end of the stack and the test will eventually SegFault. Also if the SAFE_CREAT() in setup() will fail, the close() will fail too, because the old_fd will be set to -1. I've fixed that this time and pushed (see diff bellow), thanks. @@ -117,7 +117,8 @@ static void cleanup(void) { TEST_CLEANUP; - SAFE_CLOSE(cleanup, old_fd); + if (old_fd > 0) + SAFE_CLOSE(NULL, old_fd); tst_rmdir(); } -- Cyril Hrubis chrubis@suse.cz ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list