diff options
author | bapt <bapt@FreeBSD.org> | 2015-11-07 11:02:33 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2015-11-07 11:02:33 +0000 |
commit | 41e30bab0f71e46748531a3e41f2837349a21f1a (patch) | |
tree | 0fd2d3a4c334f196b901e4e32fd6cc566b269fa5 /usr.bin | |
parent | 1f0016890f772d6be4ffc3faff26931611d4feae (diff) | |
parent | c2f5f67bd969f6441e91fc8cb611561eaef8426c (diff) | |
download | FreeBSD-src-41e30bab0f71e46748531a3e41f2837349a21f1a.zip FreeBSD-src-41e30bab0f71e46748531a3e41f2837349a21f1a.tar.gz |
Merge from head r290483
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/bsdiff/bsdiff/bsdiff.c | 28 | ||||
-rw-r--r-- | usr.bin/m4/Makefile | 4 | ||||
-rw-r--r-- | usr.bin/m4/Makefile.depend | 2 | ||||
-rw-r--r-- | usr.bin/mandoc/Makefile | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/Makefile.depend | 2 | ||||
-rw-r--r-- | usr.bin/netstat/if.c | 98 | ||||
-rw-r--r-- | usr.bin/netstat/route.c | 20 | ||||
-rw-r--r-- | usr.bin/rctl/rctl.8 | 10 | ||||
-rw-r--r-- | usr.bin/rctl/rctl.c | 2 | ||||
-rw-r--r-- | usr.bin/soelim/soelim.1 | 33 | ||||
-rw-r--r-- | usr.bin/svn/lib/Makefile | 1 |
11 files changed, 122 insertions, 82 deletions
diff --git a/usr.bin/bsdiff/bsdiff/bsdiff.c b/usr.bin/bsdiff/bsdiff/bsdiff.c index d46eed9..7e39275 100644 --- a/usr.bin/bsdiff/bsdiff/bsdiff.c +++ b/usr.bin/bsdiff/bsdiff/bsdiff.c @@ -31,7 +31,10 @@ __FBSDID("$FreeBSD$"); #include <bzlib.h> #include <err.h> +#include <errno.h> #include <fcntl.h> +#include <limits.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -230,8 +233,17 @@ int main(int argc,char *argv[]) /* Allocate oldsize+1 bytes instead of oldsize bytes to ensure that we never try to malloc(0) and get a NULL pointer */ if(((fd=open(argv[1],O_RDONLY|O_BINARY,0))<0) || - ((oldsize=lseek(fd,0,SEEK_END))==-1) || - ((old=malloc(oldsize+1))==NULL) || + ((oldsize=lseek(fd,0,SEEK_END))==-1)) + err(1, "%s", argv[1]); + + if (oldsize > SSIZE_MAX || + (uintmax_t)oldsize >= SIZE_T_MAX / sizeof(off_t) || + oldsize == OFF_MAX) { + errno = EFBIG; + err(1, "%s", argv[1]); + } + + if (((old=malloc(oldsize+1))==NULL) || (lseek(fd,0,SEEK_SET)!=0) || (read(fd,old,oldsize)!=oldsize) || (close(fd)==-1)) err(1,"%s",argv[1]); @@ -246,8 +258,16 @@ int main(int argc,char *argv[]) /* Allocate newsize+1 bytes instead of newsize bytes to ensure that we never try to malloc(0) and get a NULL pointer */ if(((fd=open(argv[2],O_RDONLY|O_BINARY,0))<0) || - ((newsize=lseek(fd,0,SEEK_END))==-1) || - ((new=malloc(newsize+1))==NULL) || + ((newsize=lseek(fd,0,SEEK_END))==-1)) + err(1, "%s", argv[2]); + + if (newsize > SSIZE_MAX || (uintmax_t)newsize >= SIZE_T_MAX || + newsize == OFF_MAX) { + errno = EFBIG; + err(1, "%s", argv[2]); + } + + if (((new=malloc(newsize+1))==NULL) || (lseek(fd,0,SEEK_SET)!=0) || (read(fd,new,newsize)!=newsize) || (close(fd)==-1)) err(1,"%s",argv[2]); diff --git a/usr.bin/m4/Makefile b/usr.bin/m4/Makefile index d955075..5511877 100644 --- a/usr.bin/m4/Makefile +++ b/usr.bin/m4/Makefile @@ -7,8 +7,8 @@ .include <src.opts.mk> PROG= m4 -CFLAGS+=-DEXTENDED -I${.CURDIR} -I${.CURDIR}/../../lib/libohash -LIBADD= y l m ohash +CFLAGS+=-DEXTENDED -I${.CURDIR} -I${.CURDIR}/../../lib/libopenbsd +LIBADD= y l m openbsd NO_WMISSING_VARIABLE_DECLARATIONS= diff --git a/usr.bin/m4/Makefile.depend b/usr.bin/m4/Makefile.depend index f5fa771..8ccf846 100644 --- a/usr.bin/m4/Makefile.depend +++ b/usr.bin/m4/Makefile.depend @@ -9,7 +9,7 @@ DIRDEPS = \ lib/${CSU_DIR} \ lib/libc \ lib/libcompiler_rt \ - lib/libohash \ + lib/libopenbsd \ lib/liby \ lib/msun \ usr.bin/lex/lib \ diff --git a/usr.bin/mandoc/Makefile b/usr.bin/mandoc/Makefile index faa46ed..9160dc0 100644 --- a/usr.bin/mandoc/Makefile +++ b/usr.bin/mandoc/Makefile @@ -82,8 +82,8 @@ SRCS+= ${DB_SRCS} WARNS?= 2 CFLAGS+= -DHAVE_CONFIG_H \ - -I${.CURDIR}/../../lib/libohash/ \ + -I${.CURDIR}/../../lib/libopenbsd/ \ -I${.CURDIR}/../../contrib/sqlite3 -LIBADD= ohash sqlite3 z +LIBADD= openbsd sqlite3 z .include <bsd.prog.mk> diff --git a/usr.bin/mandoc/Makefile.depend b/usr.bin/mandoc/Makefile.depend index e3848e3..7c705f5 100644 --- a/usr.bin/mandoc/Makefile.depend +++ b/usr.bin/mandoc/Makefile.depend @@ -9,7 +9,7 @@ DIRDEPS = \ lib/${CSU_DIR} \ lib/libc \ lib/libcompiler_rt \ - lib/libohash \ + lib/libopenbsd \ lib/libsqlite3 \ lib/libthr \ lib/libz \ diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index 96606c4..f2f689d 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -37,7 +37,7 @@ static char sccsid[] = "@(#)if.c 8.3 (Berkeley) 4/28/95"; #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include <sys/types.h> +#include <sys/param.h> #include <sys/protosw.h> #include <sys/socket.h> #include <sys/socketvar.h> @@ -271,7 +271,9 @@ intpr(void (*pfunc)(char *), int af) { struct ifaddrs *ifap, *ifa; struct ifmaddrs *ifmap, *ifma; - + u_int ifn_len_max = 5, ifn_len; + u_int has_ipv6 = 0, net_len = 13, addr_len = 17; + if (interval) return sidewaysintpr(); @@ -280,15 +282,34 @@ intpr(void (*pfunc)(char *), int af) if (aflag && getifmaddrs(&ifmap) != 0) err(EX_OSERR, "getifmaddrs"); + if (Wflag) { + for (ifa = ifap; ifa; ifa = ifa->ifa_next) { + if (interface != NULL && + strcmp(ifa->ifa_name, interface) != 0) + continue; + if (af != AF_UNSPEC && ifa->ifa_addr->sa_family != af) + continue; + ifn_len = strlen(ifa->ifa_name); + if ((ifa->ifa_flags & IFF_UP) == 0) + ++ifn_len; + ifn_len_max = MAX(ifn_len_max, ifn_len); + if (ifa->ifa_addr->sa_family == AF_INET6) + has_ipv6 = 1; + } + if (has_ipv6) { + net_len = 24; + addr_len = 39; + } else + net_len = 18; + } + xo_open_list("interface"); if (!pfunc) { - if (Wflag) - xo_emit("{T:/%-7.7s}", "Name"); - else - xo_emit("{T:/%-5.5s}", "Name"); - xo_emit(" {T:/%5.5s} {T:/%-13.13s} {T:/%-17.17s} {T:/%8.8s} " + xo_emit("{T:/%-*.*s}", ifn_len_max, ifn_len_max, "Name"); + xo_emit(" {T:/%5.5s} {T:/%-*.*s} {T:/%-*.*s} {T:/%8.8s} " "{T:/%5.5s} {T:/%5.5s}", - "Mtu", "Network", "Address", "Ipkts", "Ierrs", "Idrop"); + "Mtu", net_len, net_len, "Network", addr_len, addr_len, + "Address", "Ipkts", "Ierrs", "Idrop"); if (bflag) xo_emit(" {T:/%10.10s}","Ibytes"); xo_emit(" {T:/%8.8s} {T:/%5.5s}", "Opkts", "Oerrs"); @@ -296,13 +317,14 @@ intpr(void (*pfunc)(char *), int af) xo_emit(" {T:/%10.10s}","Obytes"); xo_emit(" {T:/%5s}", "Coll"); if (dflag) - xo_emit(" {T:/%s}", "Drop"); + xo_emit(" {T:/%5.5s}", "Drop"); xo_emit("\n"); } for (ifa = ifap; ifa; ifa = ifa->ifa_next) { bool network = false, link = false; char *name, *xname, buf[IFNAMSIZ+1]; + const char *nn, *rn; if (interface != NULL && strcmp(ifa->ifa_name, interface) != 0) continue; @@ -336,12 +358,8 @@ intpr(void (*pfunc)(char *), int af) } else xname = name; - if (Wflag) - xo_emit("{etk:name/%s}{e:flags/0x%x}{d:/%7.7s}", - name, ifa->ifa_flags, xname); - else - xo_emit("{etk:name/%s}{e:flags/0x%x}{d:/%5.5s}", - name, ifa->ifa_flags, xname); + xo_emit("{etk:name/%s}{e:flags/0x%x}{d:/%-*.*s}", + name, ifa->ifa_flags, ifn_len_max, ifn_len_max, xname); #define IFA_MTU(ifa) (((struct if_data *)(ifa)->ifa_data)->ifi_mtu) show_stat("lu", 6, "mtu", IFA_MTU(ifa), IFA_MTU(ifa), 0); @@ -349,41 +367,31 @@ intpr(void (*pfunc)(char *), int af) switch (ifa->ifa_addr->sa_family) { case AF_UNSPEC: - xo_emit("{:network/%-13.13s} ", "none"); - xo_emit("{:address/%-15.15s} ", "none"); + xo_emit("{:network/%-*.*s} ", net_len, net_len, + "none"); + xo_emit("{:address/%-*.*s} ", addr_len, addr_len, + "none"); break; case AF_INET: - if (Wflag) { - xo_emit("{t:network/%-13s} ", - netname(ifa->ifa_addr, ifa->ifa_netmask)); - xo_emit("{t:address/%-17s} ", - routename(ifa->ifa_addr, numeric_addr)); - } else { - xo_emit("{t:network/%-13.13s} ", - netname(ifa->ifa_addr, ifa->ifa_netmask)); - xo_emit("{t:address/%-17.17s} ", - routename(ifa->ifa_addr, numeric_addr)); - } - - network = true; - break; #ifdef INET6 case AF_INET6: +#endif /* INET6 */ + nn = netname(ifa->ifa_addr, ifa->ifa_netmask); + rn = routename(ifa->ifa_addr, numeric_addr); if (Wflag) { - xo_emit("{t:network/%-13s} ", - netname(ifa->ifa_addr, ifa->ifa_netmask)); - xo_emit("{t:address/%-17s} ", - routename(ifa->ifa_addr, numeric_addr)); + xo_emit("{et:network/%s}{d:/%-*s} ", + nn, net_len, nn); + xo_emit("{et:address/%s}{d:/%-*s} ", + rn, addr_len, rn); } else { - xo_emit("{t:network/%-13.13s} ", - netname(ifa->ifa_addr, ifa->ifa_netmask)); - xo_emit("{t:address/%-17.17s} ", - routename(ifa->ifa_addr, numeric_addr)); + xo_emit("{et:network/%s}{d:/%-*.*s} ", + nn, net_len, net_len, nn); + xo_emit("{et:address/%s}{d:/%-*.*s} ", + rn, addr_len, addr_len, rn); } network = true; break; -#endif /* INET6 */ case AF_LINK: { struct sockaddr_dl *sdl; @@ -391,15 +399,15 @@ intpr(void (*pfunc)(char *), int af) sdl = (struct sockaddr_dl *)ifa->ifa_addr; sprintf(linknum, "<Link#%d>", sdl->sdl_index); - xo_emit("{t:network/%-13.13s} ", linknum); + xo_emit("{t:network/%-*.*s} ", net_len, net_len, + linknum); if (sdl->sdl_nlen == 0 && sdl->sdl_alen == 0 && sdl->sdl_slen == 0) - xo_emit("{P: }"); + xo_emit("{P:/%*s} ", addr_len, ""); else - xo_emit("{:address/%*s}", - 32 - 3 * sdl->sdl_alen, - routename(ifa->ifa_addr, 1)); + xo_emit("{t:address/%-*.*s} ", addr_len, + addr_len, routename(ifa->ifa_addr, 1)); link = true; break; } diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index 7cb777b..3f6918c 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -637,14 +637,13 @@ netname4(in_addr_t in, in_addr_t mask) trimdomain(cp, strlen(cp)); } } - inet_ntop(AF_INET, &in, nline, sizeof(line)); - if (cp != NULL) { - if (strcpy(cp, nline) != 0) - return (line); + if (cp != NULL) strlcpy(line, cp, sizeof(line)); - } else + else { + inet_ntop(AF_INET, &in, nline, sizeof(nline)); strlcpy(line, nline, sizeof(line)); - domask(line + strlen(line), i, ntohl(mask)); + domask(line + strlen(line), i, ntohl(mask)); + } return (line); } @@ -688,9 +687,10 @@ static const char * netname6(struct sockaddr_in6 *sa6, struct sockaddr_in6 *mask) { static char line[NI_MAXHOST + sizeof("/xxx") - 1]; + struct sockaddr_in6 addr; char nline[NI_MAXHOST]; u_char *p, *lim; - int masklen, illegal = 0; + int masklen, illegal = 0, i; if (mask) { p = (u_char *)&mask->sin6_addr; @@ -703,6 +703,12 @@ netname6(struct sockaddr_in6 *sa6, struct sockaddr_in6 *mask) } if (illegal) xo_error("illegal prefixlen\n"); + + memcpy(&addr, sa6, sizeof(addr)); + for (i = 0; i < 16; ++i) + addr.sin6_addr.s6_addr[i] &= + mask->sin6_addr.s6_addr[i]; + sa6 = &addr; } else masklen = 128; diff --git a/usr.bin/rctl/rctl.8 b/usr.bin/rctl/rctl.8 index 9fc1c1c..c9aa6f43 100644 --- a/usr.bin/rctl/rctl.8 +++ b/usr.bin/rctl/rctl.8 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 14, 2015 +.Dd November 5, 2015 .Dt RCTL 8 .Os .Sh NAME @@ -38,19 +38,19 @@ .Op Ar filter .Nm .Fl a -.Op Ar rule +.Ar rule .Nm .Fl l .Op Fl h .Op Fl n -.Op Ar filter +.Ar filter .Nm .Fl r -.Op Ar filter +.Ar filter .Nm .Fl u .Op Fl h -.Op Ar filter +.Ar filter .Pp .Nm requires the kernel to be compiled with: diff --git a/usr.bin/rctl/rctl.c b/usr.bin/rctl/rctl.c index b534258..9153036 100644 --- a/usr.bin/rctl/rctl.c +++ b/usr.bin/rctl/rctl.c @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); #include <stdlib.h> #include <string.h> -#define RCTL_DEFAULT_BUFSIZE 4096 +#define RCTL_DEFAULT_BUFSIZE 128 * 1024 static id_t parse_user(const char *s) diff --git a/usr.bin/soelim/soelim.1 b/usr.bin/soelim/soelim.1 index 57e8614..1f4e5a83 100644 --- a/usr.bin/soelim/soelim.1 +++ b/usr.bin/soelim/soelim.1 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 1, 2015 +.Dd November 7, 2015 .Dt SOELIM 1 .Os .Sh NAME @@ -34,43 +34,48 @@ .Nm .Op Fl Crtv .Op Fl I Ar dir -.Op Ar files ... +.Op Ar .Sh DESCRIPTION +The .Nm -reads -.Ar files -lines by lines. +utility +reads the specified files or the standard input and performs the textual +inclusion implied by the +.Xr nroff 1 +directives of the form: .Pp -If a line starts by: +.Dl \&.so anotherfile +.Pp +If a line starts with: .Dq .so anotherfile -it replace the line by processing +it replaces the line by processing .Dq anotherfile . Otherwise the line is printed to stdout. .Bl -tag -width "-I dir" .It Fl C Recognise .Em .so -when not followed by a space character. +when it is not followed by a space character. .It Fl r -Compatibility with GNU groff's +Compatibility with groff's .Xr soelim 1 (does nothing). .It Fl t -Compatibility with GNU groff's +Compatibility with groff's .Xr soelim 1 (does nothing). .It Fl v -Compatibility with GNU groff's +Compatibility with groff's .Xr soelim 1 (does nothing). .It Fl I Ar dir -This option specify directories where +This option specifies directories where .Nm searches for files (both those on the command line and those named in .Dq .so directive.) -This options may be specified multiple times. The directories will be searched -in the order specified. +This option may be specified multiple times. +The directories will be searched in the order specified. .El .Pp The files are always searched first in the current directory. diff --git a/usr.bin/svn/lib/Makefile b/usr.bin/svn/lib/Makefile index ff8309b..fd3ad85 100644 --- a/usr.bin/svn/lib/Makefile +++ b/usr.bin/svn/lib/Makefile @@ -4,5 +4,6 @@ SUBDIR= libapr libapr_util libserf \ libsvn_client libsvn_delta libsvn_diff libsvn_fs libsvn_fs_fs \ libsvn_fs_util libsvn_fs_x libsvn_ra libsvn_ra_local libsvn_ra_serf \ libsvn_ra_svn libsvn_repos libsvn_subr libsvn_wc +SUBDIR_PARALLEL= .include <bsd.subdir.mk> |