[LTP] [PATCH] clnt_create: Determine the return value of clnt_create()
Ma Xinjian
maxj.fnst@fujitsu.com
Tue Oct 22 08:14:33 CEST 2024
Determine the return value of clnt_create() to avoid segmentation fault
when executing clnt_destroy() when the return value of create is NULL.
Signed-off-by: Ma Xinjian <maxj.fnst@fujitsu.com>
---
.../rpc/rpc_createdestroy_clnt_create/rpc_clnt_create.c | 7 +++++++
.../rpc_createdestroy_clnt_create/rpc_clnt_create_stress.c | 6 ++++++
.../rpc/rpc_createdestroy_clnt_destroy/rpc_clnt_destroy.c | 7 +++++++
.../rpc_clnt_destroy_stress.c | 5 +++++
.../rpc/rpc_err_clnt_pcreateerror/rpc_clnt_pcreateerror.c | 7 +++++++
.../rpc_suite/rpc/rpc_err_clnt_perrno/rpc_clnt_perrno.c | 7 +++++++
.../rpc_suite/rpc/rpc_err_clnt_perror/rpc_clnt_perror.c | 7 +++++++
.../rpc_err_clnt_spcreateerror/rpc_clnt_spcreateerror.c | 7 +++++++
.../rpc_suite/rpc/rpc_err_clnt_sperrno/rpc_clnt_sperrno.c | 7 +++++++
.../rpc_suite/rpc/rpc_err_clnt_sperror/rpc_clnt_sperror.c | 7 +++++++
.../rpc_suite/rpc/rpc_err_svcerr_auth/rpc_svcerr_auth.c | 7 +++++++
.../rpc/rpc_err_svcerr_noproc/rpc_svcerr_noproc.c | 7 +++++++
.../rpc/rpc_err_svcerr_progvers/rpc_svcerr_progvers.c | 7 +++++++
.../rpc/rpc_err_svcerr_systemerr/rpc_svcerr_systemerr.c | 7 +++++++
.../rpc/rpc_err_svcerr_weakauth/rpc_svcerr_weakauth.c | 7 +++++++
.../rpc/rpc_stdcall_clnt_control/rpc_clnt_control.c | 7 +++++++
.../rpc_stdcall_clnt_control/rpc_clnt_control_dataint.c | 7 +++++++
.../rpc/rpc_stdcall_clnt_geterr/rpc_clnt_geterr.c | 7 +++++++
.../tirpc_err_clnt_pcreateerror/tirpc_clnt_pcreateerror.c | 7 +++++++
.../tirpc/tirpc_err_clnt_perrno/tirpc_clnt_perrno.c | 7 +++++++
.../tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror.c | 7 +++++++
.../tirpc_err_clnt_perror/tirpc_clnt_perror_complex.c | 7 +++++++
.../tirpc/tirpc_toplevel_clnt_create/tirpc_clnt_create.c | 7 +++++++
.../tirpc_clnt_create_timed.c | 7 +++++++
24 files changed, 165 insertions(+)
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnt_create/rpc_clnt_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnt_create/rpc_clnt_create.c
index 98793c640..8578d943c 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnt_create/rpc_clnt_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnt_create/rpc_clnt_create.c
@@ -52,6 +52,13 @@ int main(int argn, char *argc[])
//First of all, create a client
clnt = clnt_create(argc[1], progNum, VERSNUM, proto);
+ if (clnt == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
if (run_mode == 1) {
printf("CLIENT : %p\n", clnt);
}
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnt_create/rpc_clnt_create_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnt_create/rpc_clnt_create_stress.c
index 58f55d71e..c5780d629 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnt_create/rpc_clnt_create_stress.c
+++ 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;
+ }
}
if (run_mode == 1) {
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnt_destroy/rpc_clnt_destroy.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnt_destroy/rpc_clnt_destroy.c
index f10f15d9b..85c0d5fe6 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnt_destroy/rpc_clnt_destroy.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnt_destroy/rpc_clnt_destroy.c
@@ -48,6 +48,13 @@ int main(int argn, char *argc[])
//First of all, create a client
clnt = clnt_create(argc[1], progNum, VERSNUM, proto);
+ if (clnt == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
//Then call destroy macro
clnt_destroy(clnt);
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnt_destroy/rpc_clnt_destroy_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnt_destroy/rpc_clnt_destroy_stress.c
index 9fef30f6b..ba5324c18 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnt_destroy/rpc_clnt_destroy_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnt_destroy/rpc_clnt_destroy_stress.c
@@ -56,6 +56,11 @@ int main(int argn, char *argc[])
//First of all, create a client
for (i = 0; i < nbCall; i++) {
clnt = clnt_create(argc[1], progNum, VERSNUM, proto);
+ if (clnt == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+ return 1;
+ }
clnt_destroy(clnt);
nbOk++;
}
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_pcreateerror/rpc_clnt_pcreateerror.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_pcreateerror/rpc_clnt_pcreateerror.c
index 0aaa50c27..03756cf7e 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_pcreateerror/rpc_clnt_pcreateerror.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_pcreateerror/rpc_clnt_pcreateerror.c
@@ -49,6 +49,13 @@ int main(int argn, char *argc[])
clnt = clnt_create(argc[1], progNum, VERSNUM, nettype);
+ if (clnt == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
clnt_pcreateerror("#SUCCESS");
//If we are here, test has passed
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_perrno/rpc_clnt_perrno.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_perrno/rpc_clnt_perrno.c
index 489c6c8b6..a881a4a09 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_perrno/rpc_clnt_perrno.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_perrno/rpc_clnt_perrno.c
@@ -65,6 +65,13 @@ int main(int argn, char *argc[])
//First of all, create client using top level API
clnt = clnt_create(argc[1], progNum, VERSNUM, nettype);
+ if (clnt == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
//Then call remote procedure
rslt = clnt_call((CLIENT *) clnt, PROCNUM, (xdrproc_t) xdr_int, (char *)&recVar, // xdr_in
(xdrproc_t) xdr_int, (char *)&recVar, // xdr_out
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_perror/rpc_clnt_perror.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_perror/rpc_clnt_perror.c
index 74c6201d3..ddf2ec441 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_perror/rpc_clnt_perror.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_perror/rpc_clnt_perror.c
@@ -65,6 +65,13 @@ int main(int argn, char *argc[])
//First of all, create client using top level API
clnt = clnt_create(argc[1], progNum, VERSNUM, nettype);
+ if (clnt == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
//Then call remote procedure
rslt = clnt_call((CLIENT *) clnt, PROCNUM, (xdrproc_t) xdr_void, NULL, // xdr_in
(xdrproc_t) xdr_int, (char *)&recVar, // xdr_out
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_spcreateerror/rpc_clnt_spcreateerror.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_spcreateerror/rpc_clnt_spcreateerror.c
index 65e68dae6..a85e87787 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_spcreateerror/rpc_clnt_spcreateerror.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_spcreateerror/rpc_clnt_spcreateerror.c
@@ -50,6 +50,13 @@ int main(int argn, char *argc[])
clnt = clnt_create(argc[1], progNum, VERSNUM, nettype);
+ if (clnt == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
rslt = clnt_spcreateerror("#SUCCESS");
//If we are here, test has passed
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_sperrno/rpc_clnt_sperrno.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_sperrno/rpc_clnt_sperrno.c
index 1e74c39a3..728f35a97 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_sperrno/rpc_clnt_sperrno.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_sperrno/rpc_clnt_sperrno.c
@@ -66,6 +66,13 @@ int main(int argn, char *argc[])
//First of all, create client using top level API
clnt = clnt_create(argc[1], progNum, VERSNUM, nettype);
+ if (clnt == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
//Then call remote procedure
rslt = clnt_call((CLIENT *) clnt, PROCNUM, (xdrproc_t) xdr_int, (char *)&recVar, // xdr_in
(xdrproc_t) xdr_int, (char *)&recVar, // xdr_out
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_sperror/rpc_clnt_sperror.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_sperror/rpc_clnt_sperror.c
index fc10f9e04..de4734579 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_sperror/rpc_clnt_sperror.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_clnt_sperror/rpc_clnt_sperror.c
@@ -66,6 +66,13 @@ int main(int argn, char *argc[])
//First of all, create client using top level API
clnt = clnt_create(argc[1], progNum, VERSNUM, nettype);
+ if (clnt == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
//Then call remote procedure
rslt = clnt_call((CLIENT *) clnt, PROCNUM, (xdrproc_t) xdr_void, NULL, // xdr_in
(xdrproc_t) xdr_int, (char *)&recVar, // xdr_out
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_auth/rpc_svcerr_auth.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_auth/rpc_svcerr_auth.c
index 50232a91a..34b1b2bf9 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_auth/rpc_svcerr_auth.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_auth/rpc_svcerr_auth.c
@@ -62,6 +62,13 @@ int main(int argn, char *argc[])
client = clnt_create(argc[1], progNum, VERSNUM, nettype); /* Call AuthErr RP */
+ if (client == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
cs = clnt_call(client, PROCNUM,
(xdrproc_t) xdr_int, (char *)&var_snd,
(xdrproc_t) xdr_int, (char *)&var_snd, tv);
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_noproc/rpc_svcerr_noproc.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_noproc/rpc_svcerr_noproc.c
index 3f9ea9142..4483fb6ab 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_noproc/rpc_svcerr_noproc.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_noproc/rpc_svcerr_noproc.c
@@ -65,6 +65,13 @@ int main(int argn, char *argc[])
client = clnt_create(argc[1], progNum, VERSNUM, nettype);
+ if (client == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
//Then call remote procedure
cs = clnt_call((CLIENT *) client, PROCNUM, (xdrproc_t) xdr_int, (char *)&var_snd, // xdr_in
(xdrproc_t) xdr_int, (char *)&var_snd, // xdr_out
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_progvers/rpc_svcerr_progvers.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_progvers/rpc_svcerr_progvers.c
index 8fa54d9f0..9dfc65431 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_progvers/rpc_svcerr_progvers.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_progvers/rpc_svcerr_progvers.c
@@ -62,6 +62,13 @@ int main(int argn, char *argc[])
client = clnt_create(argc[1], progNum, VERSNUM, nettype); /* Call wrong version RP */
+ if (client == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
cs = clnt_call(client, PROCNUM,
(xdrproc_t) xdr_int, (char *)&var_snd,
(xdrproc_t) xdr_int, (char *)&var_snd, tv);
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_systemerr/rpc_svcerr_systemerr.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_systemerr/rpc_svcerr_systemerr.c
index 2a45f5055..17546fe0a 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_systemerr/rpc_svcerr_systemerr.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_systemerr/rpc_svcerr_systemerr.c
@@ -62,6 +62,13 @@ int main(int argn, char *argc[])
client = clnt_create(argc[1], progNum, VERSNUM, nettype); /* Call SysErr RP */
+ if (client == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
cs = clnt_call(client, PROCNUM,
(xdrproc_t) xdr_int, (char *)&var_snd,
(xdrproc_t) xdr_int, (char *)&var_snd, tv);
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_weakauth/rpc_svcerr_weakauth.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_weakauth/rpc_svcerr_weakauth.c
index 563b11a36..a9dd71b5d 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_weakauth/rpc_svcerr_weakauth.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_err_svcerr_weakauth/rpc_svcerr_weakauth.c
@@ -62,6 +62,13 @@ int main(int argn, char *argc[])
client = clnt_create(argc[1], progNum, VERSNUM, nettype); /* Call WeakAuthErr RP */
+ if (client == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
cs = clnt_call(client, PROCNUM,
(xdrproc_t) xdr_int, (char *)&var_snd,
(xdrproc_t) xdr_int, (char *)&var_snd, tv);
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_control/rpc_clnt_control.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_control/rpc_clnt_control.c
index 0b37585ec..91d087141 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_control/rpc_clnt_control.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_control/rpc_clnt_control.c
@@ -53,6 +53,13 @@ int main(int argn, char *argc[])
//First of all, create a client
clnt = clnt_create(argc[1], progNum, VERSNUM, proto);
+ if (clnt == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
if (run_mode == 1) {
printf("CLIENT : %p\n", clnt);
}
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_control/rpc_clnt_control_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_control/rpc_clnt_control_dataint.c
index 3616d652c..10de96e10 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_control/rpc_clnt_control_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_control/rpc_clnt_control_dataint.c
@@ -54,6 +54,13 @@ int main(int argn, char *argc[])
//First of all, create a client
clnt = clnt_create(argc[1], progNum, VERSNUM, proto);
+ if (clnt == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
if (run_mode) {
printf("CLIENT : %p\n", clnt);
}
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_geterr/rpc_clnt_geterr.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_geterr/rpc_clnt_geterr.c
index 9bbce26af..d0505e623 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_geterr/rpc_clnt_geterr.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_geterr/rpc_clnt_geterr.c
@@ -53,6 +53,13 @@ int main(int argn, char *argc[])
//First of all, create a client
clnt = clnt_create(argc[1], progNum, VERSNUM, proto);
+ if (clnt == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
if (run_mode == 1) {
printf("CLIENT : %p\n", clnt);
}
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_pcreateerror/tirpc_clnt_pcreateerror.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_pcreateerror/tirpc_clnt_pcreateerror.c
index 029d158ff..81bf37e36 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_pcreateerror/tirpc_clnt_pcreateerror.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_pcreateerror/tirpc_clnt_pcreateerror.c
@@ -50,6 +50,13 @@ int main(int argn, char *argc[])
clnt = clnt_create(argc[1], progNum, VERSNUM, nettype);
+ if (clnt == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
clnt_pcreateerror("#SUCCESS");
//If we are here, test has passed
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perrno/tirpc_clnt_perrno.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perrno/tirpc_clnt_perrno.c
index a1b16416a..c3ec08887 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perrno/tirpc_clnt_perrno.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perrno/tirpc_clnt_perrno.c
@@ -65,6 +65,13 @@ int main(int argn, char *argc[])
//First of all, create client using top level API
clnt = clnt_create(argc[1], progNum, VERSNUM, nettype);
+ if (clnt == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
//Then call remote procedure
rslt = clnt_call((CLIENT *) clnt, PROCNUM, (xdrproc_t) xdr_void, NULL, // xdr_in
(xdrproc_t) xdr_int, (char *)&recVar, // xdr_out
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror.c
index 445ecfd32..8a8cdf238 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror.c
@@ -65,6 +65,13 @@ int main(int argn, char *argc[])
//First of all, create client using top level API
clnt = clnt_create(argc[1], progNum, VERSNUM, nettype);
+ if (clnt == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
//Then call remote procedure
rslt = clnt_call((CLIENT *) clnt, PROCNUM, (xdrproc_t) xdr_void, NULL, // xdr_in
(xdrproc_t) xdr_int, (char *)&recVar, // xdr_out
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror_complex.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror_complex.c
index e363e00b9..a97bbfa17 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror_complex.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror_complex.c
@@ -64,6 +64,13 @@ int main(int argn, char *argc[])
total_timeout.tv_usec = 1;
/**/ clnt = clnt_create(argc[1], progNum, VERSNUM, nettype);
+ if (clnt == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
//Multiple test case
rslt = rpc_call(argc[1], progNum, VERSNUM, PROCNUM,
(xdrproc_t) xdr_int, (char *)&sndVar,
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create/tirpc_clnt_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create/tirpc_clnt_create.c
index eaca14747..6a9aae6c0 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create/tirpc_clnt_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create/tirpc_clnt_create.c
@@ -57,6 +57,13 @@ int main(int argn, char *argc[])
}
clnt = clnt_create(argc[1], progNum, VERSNUM, nettype);
+ if (clnt == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
if (run_mode == 1) {
printf("Client after creation : %p\n", clnt);
}
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create_timed/tirpc_clnt_create_timed.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create_timed/tirpc_clnt_create_timed.c
index 43df4d95f..8723ca8c8 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create_timed/tirpc_clnt_create_timed.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create_timed/tirpc_clnt_create_timed.c
@@ -62,6 +62,13 @@ int main(int argn, char *argc[])
clnt = clnt_create_timed(argc[1], progNum, VERSNUM, nettype, &tv);
+ if (clnt == NULL) {
+ clnt_pcreateerror("err");
+ printf("%d\n", rpc_createerr.cf_stat);
+
+ return 1;
+ }
+
if (run_mode == 1) {
printf("Client after creation : %p\n", clnt);
}
--
2.42.0
More information about the ltp
mailing list