public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Ma Xinjian <maxj.fnst@fujitsu.com>
Cc: chuck.lever@oracle.com, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] clnt_create: Determine the return value of clnt_create()
Date: Tue, 22 Oct 2024 09:50:06 +0200	[thread overview]
Message-ID: <20241022075006.GA503931@pevik> (raw)
In-Reply-To: <20241022061434.2610583-1-maxj.fnst@fujitsu.com>

Hi Ma,

Thanks a lot, merged!

BTW I see some of the tests already had error control and they just printed 1
instead of rpc_createerr.cf_stat (rpc_clnt_call_dataint.c). Some other report
5 (e.g. rpc_clnt_call_performance.c). 

> Determine the return value of clnt_create() to avoid segmentation fault
> when executing clnt_destroy() when the return value of create is NULL.

...
> +++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnt_create/rpc_clnt_create_stress.c
> @@ -59,6 +59,12 @@ int main(int argn, char *argc[])

>  		if (clnt != NULL)
>  			nbOk++;
> +		else {
> +			clnt_pcreateerror("err");
> +			printf("%d\n", rpc_createerr.cf_stat);
> +
> +			return 1;
> +		}
>  	}

I reversed the condition of the check (more readable code):

		if (clnt == NULL) {
			clnt_pcreateerror("err");
			printf("%d\n", rpc_createerr.cf_stat);

			return 1;
		}

		nbOk++;

The testsuite contains a lot of duplicity and useless code. It could be
rewritten to use simple macro to remove most of the redundancy.

Kind regards,
Petr

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

      reply	other threads:[~2024-10-22  7:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-22  6:14 [LTP] [PATCH] clnt_create: Determine the return value of clnt_create() Ma Xinjian via ltp
2024-10-22  7:50 ` Petr Vorel [this message]

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=20241022075006.GA503931@pevik \
    --to=pvorel@suse.cz \
    --cc=chuck.lever@oracle.com \
    --cc=ltp@lists.linux.it \
    --cc=maxj.fnst@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