Index: bin/dd/Makefile =================================================================== RCS file: /cvsroot/src/bin/dd/Makefile,v retrieving revision 1.19 diff -p -u -r1.19 Makefile --- bin/dd/Makefile 15 Sep 2019 23:58:31 -0000 1.19 +++ bin/dd/Makefile 3 Oct 2019 07:06:40 -0000 @@ -4,7 +4,7 @@ .include RUMPPRG=dd -SRCS= args.c conv.c dd.c misc.c position.c +SRCS= args.c conv.c dd.c dd_swab.c misc.c position.c DPADD+= ${LIBUTIL} LDADD+= -lutil Index: bin/dd/dd.c =================================================================== RCS file: /cvsroot/src/bin/dd/dd.c,v retrieving revision 1.52 diff -p -u -r1.52 dd.c --- bin/dd/dd.c 23 Mar 2019 09:33:16 -0000 1.52 +++ bin/dd/dd.c 3 Oct 2019 07:06:40 -0000 @@ -456,7 +456,7 @@ dd_in(void) ++st.swab; --n; } - swab(in.dbp, in.dbp, n); + dd_swab(in.dbp, in.dbp, n); } in.dbp += in.dbrcnt; Index: bin/dd/dd_swab.c =================================================================== RCS file: bin/dd/dd_swab.c diff -N bin/dd/dd_swab.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ bin/dd/dd_swab.c 3 Oct 2019 07:06:40 -0000 @@ -0,0 +1,83 @@ +/* $NetBSD: swab.c,v 1.18 2011/01/04 17:14:07 martin Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Jeffrey Mogul. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: NetBSD: swab.c,v 1.18 2011/01/04 17:14:07 martin Exp + */ + +/* This copy has no restrict on it, that dd wants */ + +#include +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)swab.c 8.1 (Berkeley) 6/4/93"; +#else +__RCSID("$NetBSD: swab.c,v 1.18 2011/01/04 17:14:07 martin Exp $"); +#endif +#endif /* LIBC_SCCS and not lint */ + +#include + +#include "dd.h" +#include "extern.h" + +void +dd_swab(const void * from, void * to, ssize_t len) +{ + char temp; + const char *fp; + char *tp; + + if (len <= 1) + return; + + len /= 2; + fp = (const char *)from; + tp = (char *)to; +#define STEP temp = *fp++,*tp++ = *fp++,*tp++ = temp + + if (__predict_false(len == 1)) { + STEP; + return; + } + + /* round to multiple of 8 */ + while ((--len % 8) != 0) + STEP; + len /= 8; + if (len == 0) + return; + while (len-- != 0) { + STEP; STEP; STEP; STEP; + STEP; STEP; STEP; STEP; + } +} Index: bin/dd/extern.h =================================================================== RCS file: /cvsroot/src/bin/dd/extern.h,v retrieving revision 1.23 diff -p -u -r1.23 extern.h --- bin/dd/extern.h 18 Mar 2015 13:23:49 -0000 1.23 +++ bin/dd/extern.h 3 Oct 2019 07:06:40 -0000 @@ -84,3 +84,5 @@ extern const u_char e2a_32V[], e2a_POSIX extern const u_char a2ibm_32V[], a2ibm_POSIX[]; extern u_char casetab[]; extern const char *msgfmt; + +void dd_swab(const void *, void *, ssize_t len); Index: external/bsd/am-utils/dist/amd/info_ldap.c =================================================================== RCS file: /cvsroot/src/external/bsd/am-utils/dist/amd/info_ldap.c,v retrieving revision 1.2 diff -p -u -r1.2 info_ldap.c --- external/bsd/am-utils/dist/amd/info_ldap.c 28 Aug 2015 11:38:57 -0000 1.2 +++ external/bsd/am-utils/dist/amd/info_ldap.c 3 Oct 2019 07:06:40 -0000 @@ -197,7 +197,7 @@ amu_ldap_unbind(LDAP *ld) { int e; #ifdef HAVE_SIGACTION - struct sigaction sa; + struct sigaction sa, osa; #else /* not HAVE_SIGACTION */ void (*handler)(int); #endif /* not HAVE_SIGACTION */ @@ -209,7 +209,7 @@ amu_ldap_unbind(LDAP *ld) sa.sa_flags = 0; sigemptyset(&(sa.sa_mask)); sigaddset(&(sa.sa_mask), SIGPIPE); - sigaction(SIGPIPE, &sa, &sa); /* set IGNORE, and get old action */ + sigaction(SIGPIPE, &sa, &osa); /* set IGNORE, and get old action */ #else /* not HAVE_SIGACTION */ handler = signal(SIGPIPE, SIG_IGN); #endif /* not HAVE_SIGACTION */ @@ -217,9 +217,9 @@ amu_ldap_unbind(LDAP *ld) e = ldap_unbind(ld); #ifdef HAVE_SIGACTION - sigemptyset(&(sa.sa_mask)); - sigaddset(&(sa.sa_mask), SIGPIPE); - sigaction(SIGPIPE, &sa, NULL); + sigemptyset(&(osa.sa_mask)); + sigaddset(&(osa.sa_mask), SIGPIPE); + sigaction(SIGPIPE, &osa, NULL); #else /* not HAVE_SIGACTION */ (void) signal(SIGPIPE, handler); #endif /* not HAVE_SIGACTION */ Index: external/bsd/nvi/dist/common/options.c =================================================================== RCS file: /cvsroot/src/external/bsd/nvi/dist/common/options.c,v retrieving revision 1.6 diff -p -u -r1.6 options.c --- external/bsd/nvi/dist/common/options.c 7 Aug 2018 08:05:47 -0000 1.6 +++ external/bsd/nvi/dist/common/options.c 3 Oct 2019 07:06:41 -0000 @@ -356,7 +356,7 @@ opts_init(SCR *sp, int *oargs) #define OI(indx, str) { \ a.len = STRLEN(str); \ if ((const CHAR_T*)str != b2)/* GCC puts strings in text-space. */\ - (void)MEMCPY(b2, str, a.len+1); \ + (void)MEMMOVE(b2, str, a.len+1); \ if (opts_set(sp, argv, NULL)) { \ optindx = indx; \ goto err; \ Index: external/bsd/ppp/usr.sbin/pppd/sys-bsd.c =================================================================== RCS file: /cvsroot/src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c,v retrieving revision 1.5 diff -p -u -r1.5 sys-bsd.c --- external/bsd/ppp/usr.sbin/pppd/sys-bsd.c 8 Jul 2018 21:01:21 -0000 1.5 +++ external/bsd/ppp/usr.sbin/pppd/sys-bsd.c 3 Oct 2019 07:06:41 -0000 @@ -1045,11 +1045,12 @@ output(int unit, u_char *p, int len) void wait_input(struct timeval *timo) { - fd_set ready; + fd_set ready, eready; int n; ready = in_fds; - n = select(max_in_fd + 1, &ready, NULL, &ready, timo); + eready = in_fds; + n = select(max_in_fd + 1, &ready, NULL, &eready, timo); if (n < 0 && errno != EINTR) fatal("%s: select: %m", __func__); } Index: tests/lib/librumphijack/h_client.c =================================================================== RCS file: /cvsroot/src/tests/lib/librumphijack/h_client.c,v retrieving revision 1.8 diff -p -u -r1.8 h_client.c --- tests/lib/librumphijack/h_client.c 20 Apr 2012 05:15:11 -0000 1.8 +++ tests/lib/librumphijack/h_client.c 3 Oct 2019 07:06:41 -0000 @@ -71,16 +71,18 @@ main(int argc, char *argv[]) errx(EXIT_FAILURE, "stdin fileno is still set"); return EXIT_SUCCESS; } else if (strcmp(argv[1], "select_allunset") == 0) { - fd_set fds; + fd_set rfds, wfds, efds; struct timeval tv; int rv; tv.tv_sec = 0; tv.tv_usec = 1; - FD_ZERO(&fds); + FD_ZERO(&rfds); + FD_ZERO(&wfds); + FD_ZERO(&efds); - rv = select(100, &fds, &fds, &fds, &tv); + rv = select(100, &rfds, &wfds, &efds, &tv); if (rv == -1) err(EXIT_FAILURE, "select"); if (rv != 0) Index: usr.bin/rlogin/rlogin.c =================================================================== RCS file: /cvsroot/src/usr.bin/rlogin/rlogin.c,v retrieving revision 1.44 diff -p -u -r1.44 rlogin.c --- usr.bin/rlogin/rlogin.c 28 Oct 2015 08:15:53 -0000 1.44 +++ usr.bin/rlogin/rlogin.c 3 Oct 2019 07:06:41 -0000 @@ -132,7 +132,7 @@ main(int argc, char *argv[]) struct passwd *pw; struct servent *sp; struct termios tty; - sigset_t smask; + sigset_t imask, omask; uid_t uid; int argoff, ch, dflag, nflag, one; int i, len, len2; @@ -247,10 +247,10 @@ main(int argc, char *argv[]) sa.sa_handler = lostpeer; (void)sigaction(SIGPIPE, &sa, (struct sigaction *)0); /* will use SIGUSR1 for window size hack, so hold it off */ - sigemptyset(&smask); - sigaddset(&smask, SIGURG); - sigaddset(&smask, SIGUSR1); - (void)sigprocmask(SIG_SETMASK, &smask, &smask); + sigemptyset(&imask); + sigaddset(&imask, SIGURG); + sigaddset(&imask, SIGUSR1); + (void)sigprocmask(SIG_SETMASK, &imask, &omask); /* * We set SIGURG and SIGUSR1 below so that an * incoming signal will be held pending rather than being @@ -291,7 +291,7 @@ main(int argc, char *argv[]) } (void)setuid(uid); - doit(&smask); + doit(&omask); /*NOTREACHED*/ return (0); } @@ -345,21 +345,21 @@ doit(sigset_t *smask) static void setsignal(int sig) { - struct sigaction sa; - sigset_t sigs; - - sigemptyset(&sigs); - sigaddset(&sigs, sig); - sigprocmask(SIG_BLOCK, &sigs, &sigs); + struct sigaction isa, osa; + sigset_t isigs, osigs; - sigemptyset(&sa.sa_mask); - sa.sa_handler = exit; - sa.sa_flags = SA_RESTART; - (void)sigaction(sig, &sa, &sa); - if (sa.sa_handler == SIG_IGN) - (void)sigaction(sig, &sa, (struct sigaction *) 0); + sigemptyset(&isigs); + sigaddset(&isigs, sig); + sigprocmask(SIG_BLOCK, &isigs, &osigs); + + sigemptyset(&isa.sa_mask); + isa.sa_handler = exit; + isa.sa_flags = SA_RESTART; + (void)sigaction(sig, &isa, &osa); + if (osa.sa_handler == SIG_IGN) + (void)sigaction(sig, &osa, (struct sigaction *) 0); - (void)sigprocmask(SIG_SETMASK, &sigs, (sigset_t *) 0); + (void)sigprocmask(SIG_SETMASK, &osigs, (sigset_t *) 0); } static void