From 24915117a284c5536c9c707fc34ec9e7bf331f32 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 28 Aug 2011 05:31:49 +0200 Subject: [PATCH] Fixes for warnings in FreeBSD build Signed-off-by: Denys Vlasenko --- libbb/getpty.c | 18 ++++++++++-------- libbb/udp_io.c | 2 +- miscutils/less.c | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/libbb/getpty.c b/libbb/getpty.c index 6a15cff2f..435e4d09f 100644 --- a/libbb/getpty.c +++ b/libbb/getpty.c @@ -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 diff --git a/libbb/udp_io.c b/libbb/udp_io.c index b8fb6755d..7985a9723 100644 --- a/libbb/udp_io.c +++ b/libbb/udp_io.c @@ -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)); diff --git a/miscutils/less.c b/miscutils/less.c index 2c6a79326..045fd2db3 100644 --- a/miscutils/less.c +++ b/miscutils/less.c @@ -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;