[Midnightbsd-cvs] src [10347] trunk/usr.sbin/rpc.statd: sync with freebsd

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Jun 3 18:52:16 EDT 2018


Revision: 10347
          http://svnweb.midnightbsd.org/src/?rev=10347
Author:   laffer1
Date:     2018-06-03 18:52:16 -0400 (Sun, 03 Jun 2018)
Log Message:
-----------
sync with freebsd

Modified Paths:
--------------
    trunk/usr.sbin/rpc.statd/Makefile
    trunk/usr.sbin/rpc.statd/file.c
    trunk/usr.sbin/rpc.statd/statd.c

Modified: trunk/usr.sbin/rpc.statd/Makefile
===================================================================
--- trunk/usr.sbin/rpc.statd/Makefile	2018-06-03 22:50:52 UTC (rev 10346)
+++ trunk/usr.sbin/rpc.statd/Makefile	2018-06-03 22:52:16 UTC (rev 10347)
@@ -1,4 +1,5 @@
 # $MidnightBSD$
+# $FreeBSD: stable/10/usr.sbin/rpc.statd/Makefile 321274 2017-07-20 01:03:50Z ngie $
 
 PROG=	rpc.statd
 MAN=	rpc.statd.8
@@ -16,10 +17,10 @@
 RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -L -C
 
 sm_inter_svc.c: ${RPCSRC}
-	${RPCGEN} -m -o ${.TARGET} ${RPCSRC}
+	${RPCGEN} -m -o ${.TARGET} ${.ALLSRC}
 
 sm_inter.h: ${RPCSRC}
-	${RPCGEN} -h -o ${.TARGET} ${RPCSRC}
+	${RPCGEN} -h -o ${.TARGET} ${.ALLSRC}
 
 test: test.c
 	cc -o test test.c -lrpcsvc

Modified: trunk/usr.sbin/rpc.statd/file.c
===================================================================
--- trunk/usr.sbin/rpc.statd/file.c	2018-06-03 22:50:52 UTC (rev 10346)
+++ trunk/usr.sbin/rpc.statd/file.c	2018-06-03 22:52:16 UTC (rev 10347)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1995
  *	A.R. Gordon (andrew.gordon at net-tel.co.uk).  All rights reserved.
@@ -29,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.sbin/rpc.statd/file.c 300469 2016-05-23 05:38:40Z truckman $
  *
  */
 
@@ -82,6 +83,7 @@
   struct addrinfo *ai1, *ai2;
   int i;
 
+  ai2 = NULL;
   if (getaddrinfo(hostname, NULL, NULL, &ai1) != 0)
     ai1 = NULL;
   for (i = 0, hp = status_info->hosts; i < status_info->noOfHosts; i++, hp++)
@@ -91,7 +93,7 @@
       result = hp;
       break;
     }
-    if (hp->hostname[0] && 
+    if (hp->hostname[0] != '\0' &&
 	getaddrinfo(hp->hostname, NULL, NULL, &ai2) != 0)
       ai2 = NULL;
     if (ai1 && ai2)
@@ -113,8 +115,10 @@
        if (result)
 	 break;
     }
-    if (ai2)
+    if (ai2) {
       freeaddrinfo(ai2);
+      ai2 = NULL;
+    }
     if (!spare_slot && !hp->monList && !hp->notifyReqd)
       spare_slot = hp;
   }
@@ -134,9 +138,8 @@
     if (desired_size > status_file_len)
     {
       /* Extend file by writing 1 byte of junk at the desired end pos	*/
-      lseek(status_fd, desired_size - 1, SEEK_SET);
-      i = write(status_fd, &i, 1);
-      if (i < 1)
+      if (lseek(status_fd, desired_size - 1, SEEK_SET) == -1 ||
+          write(status_fd, "\0", 1) < 0)
       {
 	syslog(LOG_ERR, "Unable to extend status file");
 	return (NULL);

Modified: trunk/usr.sbin/rpc.statd/statd.c
===================================================================
--- trunk/usr.sbin/rpc.statd/statd.c	2018-06-03 22:50:52 UTC (rev 10346)
+++ trunk/usr.sbin/rpc.statd/statd.c	2018-06-03 22:52:16 UTC (rev 10347)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1995
  *	A.R. Gordon (andrew.gordon at net-tel.co.uk).  All rights reserved.
@@ -36,7 +37,7 @@
 /* The actual program logic is in the file procs.c			*/
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.sbin/rpc.statd/statd.c 277859 2015-01-28 21:51:34Z rstone $");
 
 #include <err.h>
 #include <errno.h>
@@ -343,7 +344,6 @@
 
 	/* Get rpc.statd's address on this transport */
 	memset(&hints, 0, sizeof hints);
-	hints.ai_flags = AI_PASSIVE;
 	hints.ai_family = si.si_af;
 	hints.ai_socktype = si.si_socktype;
 	hints.ai_protocol = si.si_proto;
@@ -359,6 +359,7 @@
 			out_of_mem();
 		sock_fd[sock_fdcnt++] = -1;	/* Set invalid for now. */
 		mallocd_res = 0;
+		hints.ai_flags = AI_PASSIVE;
 
 		/*	
 		 * XXX - using RPC library internal functions.



More information about the Midnightbsd-cvs mailing list