Fixes for warnings in FreeBSD build

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2011-08-28 05:31:49 +02:00
parent 1285437217
commit 24915117a2
3 changed files with 13 additions and 11 deletions

View File

@ -19,20 +19,22 @@ int FAST_FUNC xgetpty(char *line)
if (p > 0) { if (p > 0) {
grantpt(p); /* chmod+chown corresponding slave pty */ grantpt(p); /* chmod+chown corresponding slave pty */
unlockpt(p); /* (what does this do?) */ unlockpt(p); /* (what does this do?) */
#ifndef HAVE_PTSNAME_R # ifndef HAVE_PTSNAME_R
const char *name; {
name = ptsname(p); /* find out the name of slave pty */ const char *name;
if (!name) { name = ptsname(p); /* find out the name of slave pty */
bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)"); 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 */ /* find out the name of slave pty */
if (ptsname_r(p, line, GETPTY_BUFSIZE-1) != 0) { if (ptsname_r(p, line, GETPTY_BUFSIZE-1) != 0) {
bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)"); bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)");
} }
line[GETPTY_BUFSIZE-1] = '\0'; line[GETPTY_BUFSIZE-1] = '\0';
#endif # endif
return p; return p;
} }
#else #else

View File

@ -13,7 +13,7 @@
* We don't check for errors here. Not supported == won't be used * We don't check for errors here. Not supported == won't be used
*/ */
void FAST_FUNC void FAST_FUNC
socket_want_pktinfo(int fd) socket_want_pktinfo(int fd UNUSED_PARAM)
{ {
#ifdef IP_PKTINFO #ifdef IP_PKTINFO
setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &const_int_1, sizeof(int)); setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &const_int_1, sizeof(int));

View File

@ -721,8 +721,8 @@ static void print_found(const char *line)
while (match_status == 0) { while (match_status == 0) {
char *new = xasprintf("%s%.*s"HIGHLIGHT"%.*s"NORMAL, char *new = xasprintf("%s%.*s"HIGHLIGHT"%.*s"NORMAL,
growline ? growline : "", growline ? growline : "",
match_structs.rm_so, str, (int)match_structs.rm_so, str,
match_structs.rm_eo - match_structs.rm_so, (int)(match_structs.rm_eo - match_structs.rm_so),
str + match_structs.rm_so); str + match_structs.rm_so);
free(growline); free(growline);
growline = new; growline = new;