Author: pfg
Date: Thu Dec 28 17:44:30 2017
New Revision: 327289
URL: https://svnweb.freebsd.org/changeset/base/327289

Log:
  rpc.sprayd: Bring some changes from NetBSD.
  
  Most notable, other than some style issues:
  CVS 1.11:
    do not use LOG_CONS.
  CVS 1.13:
    consistently use exit instead of return in main().
    use LOG_WARNING instead of LOG_ERR for non critical errors.
  
  Obtained from:        NetBSD
  MFC after:    2 weeks

Modified:
  head/libexec/rpc.sprayd/rpc.sprayd.8
  head/libexec/rpc.sprayd/sprayd.c

Modified: head/libexec/rpc.sprayd/rpc.sprayd.8
==============================================================================
--- head/libexec/rpc.sprayd/rpc.sprayd.8        Thu Dec 28 14:26:33 2017        
(r327288)
+++ head/libexec/rpc.sprayd/rpc.sprayd.8        Thu Dec 28 17:44:30 2017        
(r327289)
@@ -1,3 +1,4 @@
+.\"    $NetBSD: rpc.sprayd.8,v 1.9 2003/02/25 10:34:50 wiz Exp $
 .\"
 .\" Copyright (c) 1994 Christos Zoulas
 .\" All rights reserved.
@@ -29,11 +30,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 22, 1994
+.Dd December 27, 2017
 .Dt RPC.SPRAYD 8
 .Os
 .Sh NAME
-.Nm rpc.sprayd
+.Nm rpc.sprayd ,
+.Nm sprayd
 .Nd spray server
 .Sh SYNOPSIS
 .Nm /usr/libexec/rpc.sprayd

Modified: head/libexec/rpc.sprayd/sprayd.c
==============================================================================
--- head/libexec/rpc.sprayd/sprayd.c    Thu Dec 28 14:26:33 2017        
(r327288)
+++ head/libexec/rpc.sprayd/sprayd.c    Thu Dec 28 17:44:30 2017        
(r327289)
@@ -1,3 +1,5 @@
+/*     $NetBSD: sprayd.c,v 1.14 2006/05/09 20:18:07 mrg Exp $  */
+
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
  *
@@ -64,7 +66,7 @@ static int from_inetd = 1;
 void
 cleanup(int sig __unused)
 {
-       (void) rpcb_unset(SPRAYPROG, SPRAYVERS, NULL);
+       (void)rpcb_unset(SPRAYPROG, SPRAYVERS, NULL);
        exit(0);
 }
 
@@ -93,17 +95,17 @@ main(int argc, char *argv[])
        if (!from_inetd) {
                daemon(0, 0);
 
-               (void) rpcb_unset(SPRAYPROG, SPRAYVERS, NULL);
+               (void)rpcb_unset(SPRAYPROG, SPRAYVERS, NULL);
 
-               (void) signal(SIGINT, cleanup);
-               (void) signal(SIGTERM, cleanup);
-               (void) signal(SIGHUP, cleanup);
+               (void)signal(SIGINT, cleanup);
+               (void)signal(SIGTERM, cleanup);
+               (void)signal(SIGHUP, cleanup);
        } else {
-               (void) signal(SIGALRM, die);
+               (void)signal(SIGALRM, die);
                alarm(TIMEOUT);
        }
 
-       openlog("rpc.sprayd", LOG_CONS|LOG_PID, LOG_DAEMON);
+       openlog("rpc.sprayd", LOG_PID, LOG_DAEMON);
 
        if (from_inetd) {
                transp = svc_tli_create(0, NULL, NULL, 0, 0);
@@ -120,7 +122,7 @@ main(int argc, char *argv[])
                syslog(LOG_ERR,
                    "unable to register (SPRAYPROG, SPRAYVERS, %s)",
                    (!from_inetd)?"udp":"(inetd)");
-               return 1;
+               exit(1);
        }
 
        svc_run();
@@ -138,7 +140,7 @@ spray_service(struct svc_req *rqstp, SVCXPRT *transp)
        switch (rqstp->rq_proc) {
        case SPRAYPROC_CLEAR:
                scum.counter = 0;
-               (void) gettimeofday(&clear, 0);
+               (void)gettimeofday(&clear, 0);
                /*FALLTHROUGH*/
 
        case NULLPROC:
@@ -150,7 +152,7 @@ spray_service(struct svc_req *rqstp, SVCXPRT *transp)
                return;
 
        case SPRAYPROC_GET:
-               (void) gettimeofday(&get, 0);
+               (void)gettimeofday(&get, 0);
                timersub(&get, &clear, &get);
                scum.clock.sec = get.tv_sec;
                scum.clock.usec = get.tv_usec;
@@ -163,6 +165,6 @@ spray_service(struct svc_req *rqstp, SVCXPRT *transp)
 
        if (!svc_sendreply(transp, (xdrproc_t)xdr_spraycumul, &scum)) {
                svcerr_systemerr(transp);
-               syslog(LOG_ERR, "bad svc_sendreply");
+               syslog(LOG_WARNING, "bad svc_sendreply");
        }
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to