Fixes for warnings in FreeBSD build
authorDenys Vlasenko <vda.linux@googlemail.com>
Sun, 28 Aug 2011 03:31:49 +0000 (05:31 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 28 Aug 2011 03:31:49 +0000 (05:31 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
libbb/getpty.c
libbb/udp_io.c
miscutils/less.c

index 6a15cff2fb36bcddd0ad2e58ebf119cba8c4660a..435e4d09f301e6e5bcefe9c81c8986728aaa3c34 100644 (file)
@@ -19,20 +19,22 @@ int FAST_FUNC xgetpty(char *line)
        if (p > 0) {
                grantpt(p); /* chmod+chown corresponding slave pty */
                unlockpt(p); /* (what does this do?) */
-#ifndef HAVE_PTSNAME_R
-               const char *name;
-               name = ptsname(p); /* find out the name of slave pty */
-               if (!name) {
-                       bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)");
+# ifndef HAVE_PTSNAME_R
+               {
+                       const char *name;
+                       name = ptsname(p); /* find out the name of slave pty */
+                       if (!name) {
+                               bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)");
+                       }
+                       safe_strncpy(line, name, GETPTY_BUFSIZE);
                }
-               safe_strncpy(line, name, GETPTY_BUFSIZE);
-#else
+# else
                /* find out the name of slave pty */
                if (ptsname_r(p, line, GETPTY_BUFSIZE-1) != 0) {
                        bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)");
                }
                line[GETPTY_BUFSIZE-1] = '\0';
-#endif
+# endif
                return p;
        }
 #else
index b8fb6755dc5455099dbb87db3d4ac98ab3197de8..7985a97233a67775f8b519778c18c17a0bdaa69c 100644 (file)
@@ -13,7 +13,7 @@
  * We don't check for errors here. Not supported == won't be used
  */
 void FAST_FUNC
-socket_want_pktinfo(int fd)
+socket_want_pktinfo(int fd UNUSED_PARAM)
 {
 #ifdef IP_PKTINFO
        setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &const_int_1, sizeof(int));
index 2c6a7932680e72be9495b3e929e08a1f557aad63..045fd2db3db568b615974800c6c05fa399273949 100644 (file)
@@ -721,8 +721,8 @@ static void print_found(const char *line)
        while (match_status == 0) {
                char *new = xasprintf("%s%.*s"HIGHLIGHT"%.*s"NORMAL,
                                growline ? growline : "",
-                               match_structs.rm_so, str,
-                               match_structs.rm_eo - match_structs.rm_so,
+                               (int)match_structs.rm_so, str,
+                               (int)(match_structs.rm_eo - match_structs.rm_so),
                                                str + match_structs.rm_so);
                free(growline);
                growline = new;