On Sat, Apr 27, 2013 at 10:30:01PM +0200, Maxime Villard wrote:

> Hi,
> here is a patch to remove two useless variables in ntpd. Spotted
> when recompiling with -Wextra.
> 
> Ok/Comments?

Looks like 'auth' has been removed in revision 1.8 and 'len' in
revision 1.17 of ntp_msg.c but not removed from the function
arguments list.

So I think the diff is good.

 
> Index: client.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ntpd/client.c,v
> retrieving revision 1.89
> diff -u -p -r1.89 client.c
> --- client.c  21 Sep 2011 15:41:30 -0000      1.89
> +++ client.c  27 Apr 2013 21:59:52 -0000
> @@ -186,8 +186,7 @@ client_query(struct ntp_peer *p)
>       p->query->msg.xmttime.fractionl = arc4random();
>       p->query->xmttime = gettime_corrected();
>  
> -     if (ntp_sendmsg(p->query->fd, NULL, &p->query->msg,
> -         NTP_MSGSIZE_NOAUTH, 0) == -1) {
> +     if (ntp_sendmsg(p->query->fd, NULL, &p->query->msg) == -1) {
>               p->senderrors++;
>               set_next(p, INTERVAL_QUERY_PATHETIC);
>               p->trustlevel = TRUSTLEVEL_PATHETIC;
> Index: ntp_msg.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ntpd/ntp_msg.c,v
> retrieving revision 1.18
> diff -u -p -r1.18 ntp_msg.c
> --- ntp_msg.c 19 Oct 2007 15:53:57 -0000      1.18
> +++ ntp_msg.c 27 Apr 2013 21:59:52 -0000
> @@ -40,8 +40,7 @@ ntp_getmsg(struct sockaddr *sa, char *p,
>  }
>  
>  int
> -ntp_sendmsg(int fd, struct sockaddr *sa, struct ntp_msg *msg, ssize_t len,
> -    int auth)
> +ntp_sendmsg(int fd, struct sockaddr *sa, struct ntp_msg *msg)
>  {
>       socklen_t       sa_len;
>       ssize_t         n;
> Index: ntpd.h
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ntpd/ntpd.h,v
> retrieving revision 1.106
> diff -u -p -r1.106 ntpd.h
> --- ntpd.h    20 Sep 2012 12:43:16 -0000      1.106
> +++ ntpd.h    27 Apr 2013 21:59:52 -0000
> @@ -226,7 +226,7 @@ struct ntp_conf_sensor    *new_sensor(char 
>  
>  /* ntp_msg.c */
>  int  ntp_getmsg(struct sockaddr *, char *, ssize_t, struct ntp_msg *);
> -int  ntp_sendmsg(int, struct sockaddr *, struct ntp_msg *, ssize_t, int);
> +int  ntp_sendmsg(int, struct sockaddr *, struct ntp_msg *);
>  
>  /* server.c */
>  int  setup_listeners(struct servent *, struct ntpd_conf *, u_int *);
> Index: server.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ntpd/server.c,v
> retrieving revision 1.36
> diff -u -p -r1.36 server.c
> --- server.c  21 Sep 2011 15:41:30 -0000      1.36
> +++ server.c  27 Apr 2013 21:59:52 -0000
> @@ -210,6 +210,6 @@ server_dispatch(int fd, struct ntpd_conf
>       reply.rootdelay = d_to_sfp(lconf->status.rootdelay);
>       reply.refid = lconf->status.refid;
>  
> -     ntp_sendmsg(fd, (struct sockaddr *)&fsa, &reply, size, 0);
> +     ntp_sendmsg(fd, (struct sockaddr *)&fsa, &reply);
>       return (0);
>  }
> 

Reply via email to