svn commit: r352570 - head/usr.sbin/rpc.statd

Hiroki Sato hrs at FreeBSD.org
Sat Sep 21 01:30:00 UTC 2019


Author: hrs
Date: Sat Sep 21 01:29:59 2019
New Revision: 352570
URL: https://svnweb.freebsd.org/changeset/base/352570

Log:
  Fix build errors of test.c, which had been broken for a long time.
  This is a temporary fix and should be converted to a complete
  test scenarios by using this tool.

Modified:
  head/usr.sbin/rpc.statd/Makefile
  head/usr.sbin/rpc.statd/test.c

Modified: head/usr.sbin/rpc.statd/Makefile
==============================================================================
--- head/usr.sbin/rpc.statd/Makefile	Sat Sep 21 01:23:08 2019	(r352569)
+++ head/usr.sbin/rpc.statd/Makefile	Sat Sep 21 01:29:59 2019	(r352570)
@@ -20,7 +20,8 @@ sm_inter_svc.c: ${RPCSRC}
 sm_inter.h: ${RPCSRC}
 	${RPCGEN} -h -o ${.TARGET} ${.ALLSRC}
 
-test: test.c
-	cc -o test test.c -lrpcsvc
+test: test.o
+	${CC} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} ${LIBADD:S/^/-l/}
+CLEANFILES+=	test test.o
 
 .include <bsd.prog.mk>

Modified: head/usr.sbin/rpc.statd/test.c
==============================================================================
--- head/usr.sbin/rpc.statd/test.c	Sat Sep 21 01:23:08 2019	(r352569)
+++ head/usr.sbin/rpc.statd/test.c	Sat Sep 21 01:29:59 2019	(r352570)
@@ -1,14 +1,14 @@
-
 #ifndef lint
 static const char rcsid[] =
   "$FreeBSD$";
 #endif /* not lint */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <rpc/rpc.h>
 #include <rpcsvc/sm_inter.h>
 
-
 /* Default timeout can be changed using clnt_control() */
 static struct timeval TIMEOUT = { 25, 0 };
 
@@ -20,7 +20,8 @@ sm_stat_1(argp, clnt)
 	static struct sm_stat_res res;
 
 	bzero((char *)&res, sizeof(res));
-	if (clnt_call(clnt, SM_STAT, xdr_sm_name, argp, xdr_sm_stat_res, &res, TIMEOUT) != RPC_SUCCESS) {
+	if (clnt_call(clnt, SM_STAT, (xdrproc_t)xdr_sm_name, argp,
+	    (xdrproc_t)xdr_sm_stat_res, &res, TIMEOUT) != RPC_SUCCESS) {
 		return (NULL);
 	}
 	return (&res);
@@ -35,7 +36,8 @@ sm_mon_1(argp, clnt)
 	static struct sm_stat_res res;
 
 	bzero((char *)&res, sizeof(res));
-	if (clnt_call(clnt, SM_MON, xdr_mon, argp, xdr_sm_stat_res, &res, TIMEOUT) != RPC_SUCCESS) {
+	if (clnt_call(clnt, SM_MON, (xdrproc_t)xdr_mon, argp,
+	    (xdrproc_t)xdr_sm_stat_res, &res, TIMEOUT) != RPC_SUCCESS) {
 		return (NULL);
 	}
 	return (&res);
@@ -50,7 +52,8 @@ sm_unmon_1(argp, clnt)
 	static struct sm_stat res;
 
 	bzero((char *)&res, sizeof(res));
-	if (clnt_call(clnt, SM_UNMON, xdr_mon_id, argp, xdr_sm_stat, &res, TIMEOUT) != RPC_SUCCESS) {
+	if (clnt_call(clnt, SM_UNMON, (xdrproc_t)xdr_mon_id, argp,
+	    (xdrproc_t)xdr_sm_stat, &res, TIMEOUT) != RPC_SUCCESS) {
 		return (NULL);
 	}
 	return (&res);
@@ -65,7 +68,8 @@ sm_unmon_all_1(argp, clnt)
 	static struct sm_stat res;
 
 	bzero((char *)&res, sizeof(res));
-	if (clnt_call(clnt, SM_UNMON_ALL, xdr_my_id, argp, xdr_sm_stat, &res, TIMEOUT) != RPC_SUCCESS) {
+	if (clnt_call(clnt, SM_UNMON_ALL, (xdrproc_t)xdr_my_id, argp,
+	    (xdrproc_t)xdr_sm_stat, &res, TIMEOUT) != RPC_SUCCESS) {
 		return (NULL);
 	}
 	return (&res);
@@ -80,7 +84,8 @@ sm_simu_crash_1(argp, clnt)
 	static char res;
 
 	bzero((char *)&res, sizeof(res));
-	if (clnt_call(clnt, SM_SIMU_CRASH, xdr_void, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
+	if (clnt_call(clnt, SM_SIMU_CRASH, (xdrproc_t)xdr_void, argp,
+	    (xdrproc_t)xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
 		return (NULL);
 	}
 	return ((void *)&res);
@@ -119,25 +124,20 @@ int main(int argc, char **argv)
   {
     /* Hostname given		*/
     struct sm_stat_res *res;
-    if (res = sm_mon_1(&mon, cli))
-    {
+
+    res = sm_mon_1(&mon, cli);
+    if (res)
       printf("Success!\n");
-    }
     else
-    {
       printf("Fail\n");  
-    }
   }
   else
   {
-    if (out = sm_simu_crash_1(&dummy, cli))
-    {
+    out = sm_simu_crash_1(&dummy, cli);
+    if (out)
       printf("Success!\n");
-    }
     else
-    {
       printf("Fail\n");  
-    }
   }
 
   return 0;


More information about the svn-src-head mailing list