public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: ltp-list@lists.sourceforge.net
Subject: [LTP] [PATCH] recvmsg01: kill child only if one was forked
Date: Mon, 07 Nov 2011 13:53:42 +0100	[thread overview]
Message-ID: <4EB7D4D6.5000704@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 386 bytes --]


If start_server() fails, then pid will end up with -1 and
cleanup() will do kill(-1, SIGKILL), which kills everything
this process can kill.

Change the test to kill pid (child) only when it successfully
creates one.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
  testcases/kernel/syscalls/recvmsg/recvmsg01.c |    5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)



[-- Attachment #2: 0001-recvmsg01-kill-child-only-if-one-was-forked.patch --]
[-- Type: text/x-patch, Size: 632 bytes --]

diff --git a/testcases/kernel/syscalls/recvmsg/recvmsg01.c b/testcases/kernel/syscalls/recvmsg/recvmsg01.c
index ba3b0fd..41d0726 100644
--- a/testcases/kernel/syscalls/recvmsg/recvmsg01.c
+++ b/testcases/kernel/syscalls/recvmsg/recvmsg01.c
@@ -281,7 +281,8 @@ void setup(void)
 
 void cleanup(void)
 {
-	(void)kill(pid, SIGKILL);	/* kill server */
+	if (pid > 0)
+		(void)kill(pid, SIGKILL);	/* kill server */
 	if (tmpsunpath[0] != '\0')
 		(void)unlink(tmpsunpath);
 	TEST_CLEANUP;
@@ -528,4 +529,4 @@ void sender(int fd)
 	(void)sendmsg(fd, &mh, 0);
 	(void)close(tfd);
 	(void)unlink(tmpfn);
-}
\ No newline at end of file
+}


[-- Attachment #3: Type: text/plain, Size: 169 bytes --]

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

             reply	other threads:[~2011-11-07 12:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-07 12:53 Jan Stancek [this message]
2011-11-08  3:07 ` [LTP] [PATCH] recvmsg01: kill child only if one was forked Wanlong Gao
2011-11-08  7:14   ` Jan Stancek
2011-11-08  7:21     ` Wanlong Gao
2011-11-08  7:50       ` Jan Stancek
2011-11-08  8:08         ` Wanlong Gao
2011-11-16 14:24 ` Cyril Hrubis

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=4EB7D4D6.5000704@redhat.com \
    --to=jstancek@redhat.com \
    --cc=ltp-list@lists.sourceforge.net \
    /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