Author: dim
Date: Tue Aug 30 20:27:22 2016
New Revision: 305086
URL: https://svnweb.freebsd.org/changeset/base/305086

Log:
  Fix warnings in telnet about invalid constant conversions, e.g.:
  
  contrib/telnet/telnet/commands.c:2914:13: error: implicit conversion
  from 'int' to 'char' changes value from 137 to -119
  [-Werror,-Wconstant-conversion]
                  *lsrp++ = IPOPT_SSRR;
                          ~ ^~~~~~~~~~
  /usr/include/netinet/ip.h:152:21: note: expanded from macro 'IPOPT_SSRR'
  #define IPOPT_SSRR              137             /* strict source route */
                                  ^~~
  contrib/telnet/telnet/commands.c:2916:13: error: implicit conversion
  from 'int' to 'char' changes value from 131 to -125
  [-Werror,-Wconstant-conversion]
                  *lsrp++ = IPOPT_LSRR;
                          ~ ^~~~~~~~~~
  /usr/include/netinet/ip.h:148:21: note: expanded from macro 'IPOPT_LSRR'
  #define IPOPT_LSRR              131             /* loose source route */
                                  ^~~
  
  Use unsigned char buffers instead.
  
  MFC after:    1 week

Modified:
  head/contrib/telnet/telnet/commands.c

Modified: head/contrib/telnet/telnet/commands.c
==============================================================================
--- head/contrib/telnet/telnet/commands.c       Tue Aug 30 20:24:50 2016        
(r305085)
+++ head/contrib/telnet/telnet/commands.c       Tue Aug 30 20:27:22 2016        
(r305086)
@@ -112,7 +112,7 @@ static int send_tncmd(void (*)(int, int)
 static int setmod(int);
 static int clearmode(int);
 static int modehelp(void);
-static int sourceroute(struct addrinfo *, char *, char **, int *, int *, int 
*);
+static int sourceroute(struct addrinfo *, char *, unsigned char **, int *, int 
*, int *);
 
 typedef struct {
        const char *name;       /* command name */
@@ -2171,7 +2171,7 @@ switch_af(struct addrinfo **aip)
 int
 tn(int argc, char *argv[])
 {
-    char *srp = 0;
+    unsigned char *srp = 0;
     int proto, opt;
     int srlen;
     int srcroute = 0, result;
@@ -2844,10 +2844,10 @@ cmdrc(char *m1, char *m2)
  *             setsockopt, as socket protocol family.
  */
 static int
-sourceroute(struct addrinfo *ai, char *arg, char **cpp, int *lenp, int 
*protop, int *optp)
+sourceroute(struct addrinfo *ai, char *arg, unsigned char **cpp, int *lenp, 
int *protop, int *optp)
 {
        static char buf[1024 + ALIGNBYTES];     /*XXX*/
-       char *cp, *cp2, *lsrp, *ep;
+       unsigned char *cp, *cp2, *lsrp, *ep;
        struct sockaddr_in *_sin;
 #ifdef INET6
        struct sockaddr_in6 *sin6;
_______________________________________________
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