From: chrubis@suse.cz
To: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH v3] dup3(2): add EINVAL error number test
Date: Thu, 28 Nov 2013 15:35:05 +0100 [thread overview]
Message-ID: <20131128143504.GF19263@rei.Home> (raw)
In-Reply-To: <528DE213.1030106@cn.fujitsu.com>
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
next prev parent reply other threads:[~2013-11-28 14:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-21 10:36 [LTP] [PATCH v3] dup3(2): add EINVAL error number test Xiaoguang Wang
2013-11-28 14:35 ` chrubis [this message]
2013-11-28 16:55 ` Markos Chandras
2013-11-28 17:09 ` chrubis
[not found] ` <52977A31.8060400@imgtec.com>
2013-11-28 17:21 ` chrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131128143504.GF19263@rei.Home \
--to=chrubis@suse.cz \
--cc=ltp-list@lists.sourceforge.net \
--cc=wangxg.fnst@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox