public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Joerg Vehlow <lkml@jv-coder.de>
Cc: Joerg Vehlow <joerg.vehlow@aox-tech.de>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 02/12] posix/mq_(timed)send/5-1: Fix error reporting
Date: Fri, 19 Nov 2021 15:44:39 +0100	[thread overview]
Message-ID: <YZe4V8mbn7Dk8x3U@yuki> (raw)
In-Reply-To: <20211119074602.857595-3-lkml@jv-coder.de>

Hi!
Applied, thanks.

> --- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c
> @@ -58,7 +58,6 @@ int main(void)
>  	char msgrcd[BUFFER];
>  	const char *msgptr = MSGSTR;
>  	struct mq_attr attr;
> -	int unresolved = 0;
>  	unsigned pri;
>  
>  	sprintf(gqname, "/mq_timedsend_5-1_%d", getpid());
> @@ -119,7 +118,10 @@ int main(void)
>  		/* receive message and allow blocked send to complete */
>  		if (mq_receive(gqueue, msgrcd, BUFFER, &pri) == -1) {
>  			perror("mq_receive() did not return success");
> -			unresolved = 1;
> +			kill(pid, SIGKILL);	//kill child
> +			mq_close(gqueue);
> +			mq_unlink(gqname);
> +			return PTS_UNRESOLVED;
>  		}

There is another place where it does not clean up the queue in the code
under the if (j == MAXMSG+1) condition, that should be fixed as well.

Also I guess the cleanest way how to write this test would be a kernel
style goto cleanup. E.g.:

	int rval = PTS_UNRESOLVED;


	if (foo) {
		rval = PTS_FAIL;
		goto ret;
	}

	if (bar)
		goto ret;

	...

	pid = 0;
ret:
	if (pid)
		kill(pid, SIGKILL);
	mq_close(queue);
	mq_unlink(queue);
	return rval;
-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2021-11-19 14:43 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19  7:45 [LTP] [Patch 00/12] Fix or suppress compiler warnings in posix/conformance/interfaces Joerg Vehlow
2021-11-19  7:45 ` [LTP] [PATCH 01/12] posix/pthread_create/15-1: Supress warning Joerg Vehlow
2021-11-19 14:34   ` Cyril Hrubis
2021-11-19  7:45 ` [LTP] [PATCH 02/12] posix/mq_(timed)send/5-1: Fix error reporting Joerg Vehlow
2021-11-19 14:44   ` Cyril Hrubis [this message]
2021-11-22  6:45     ` Joerg Vehlow
2021-11-22  9:10       ` Cyril Hrubis
2021-11-19  7:45 ` [LTP] [PATCH 03/12] posix/pthread_create/*: Remove unused variable Joerg Vehlow
2021-11-19 14:51   ` Cyril Hrubis
2021-11-19  7:45 ` [LTP] [PATCH 04/12] posix/conformance/interfaces: Fix unsued-variable for testfrmw Joerg Vehlow
2021-11-19 15:07   ` Cyril Hrubis
2021-11-22  6:48     ` Joerg Vehlow
2021-11-19  7:45 ` [LTP] [PATCH 05/12] posix/conformance/interfaces: Fix all unused variable warnings Joerg Vehlow
2021-11-19 15:23   ` Cyril Hrubis
2021-11-22  6:41     ` Joerg Vehlow
2021-11-22  9:43       ` Cyril Hrubis
2021-11-19  7:45 ` [LTP] [PATCH 06/12] posix/conformance/interfaces: Fix all unused function warnings Joerg Vehlow
2021-11-19 15:27   ` Cyril Hrubis
2021-11-19  7:45 ` [LTP] [PATCH 07/12] posix/pthread_key_create/2-1: Remove invalid part of test Joerg Vehlow
2021-11-19 15:32   ` Cyril Hrubis
2021-11-19  7:45 ` [LTP] [PATCH 08/12] posix/asctime: Fix potentioal buffer overflow Joerg Vehlow
2021-11-19 15:33   ` Cyril Hrubis
2021-11-19  7:45 ` [LTP] [PATCH 09/12] posix/conformance/interfaces/pthread_*_destroy: Suppress nonnull warning Joerg Vehlow
2021-11-19 15:35   ` Cyril Hrubis
2021-11-19  7:46 ` [LTP] [PATCH 10/12] posix/conformance/interfaces: Fix all sign-compare warnings Joerg Vehlow
2021-11-19 15:37   ` Cyril Hrubis
2021-11-19  7:46 ` [LTP] [PATCH 11/12] posix/conformance/interface/mmap/5-1: Remove invalid static Joerg Vehlow
2021-11-19 15:38   ` Cyril Hrubis
2021-11-19  7:46 ` [LTP] [PATCH 12/12] posix/interface/conformance: Fix/supress all unused-result warnings Joerg Vehlow
2021-11-19 15:43   ` Cyril Hrubis
2021-11-22  6:42     ` Joerg Vehlow

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=YZe4V8mbn7Dk8x3U@yuki \
    --to=chrubis@suse.cz \
    --cc=joerg.vehlow@aox-tech.de \
    --cc=lkml@jv-coder.de \
    --cc=ltp@lists.linux.it \
    /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