aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-12-11 09:05:01 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-12-11 09:05:01 +0000
commitb088e5ee4ac4e73b126add1da7d59a01c1b5e093 (patch)
tree5a36730c2e1ad89de47dbff177e48dd24d38fd88
parent480d40634cd22d5c6492f13779f8a23e18fd7edb (diff)
downloadmandoc-b088e5ee4ac4e73b126add1da7d59a01c1b5e093.tar.gz
mandoc-b088e5ee4ac4e73b126add1da7d59a01c1b5e093.tar.zst
mandoc-b088e5ee4ac4e73b126add1da7d59a01c1b5e093.zip
sync to OpenBSD
-rw-r--r--compat_fts.c9
-rw-r--r--compat_reallocarray.c10
-rw-r--r--compat_strsep.c3
3 files changed, 15 insertions, 7 deletions
diff --git a/compat_fts.c b/compat_fts.c
index 4caf74c1..2203f360 100644
--- a/compat_fts.c
+++ b/compat_fts.c
@@ -6,8 +6,8 @@ int dummy;
#else
-/* $Id: compat_fts.c,v 1.4 2014/08/17 20:45:59 schwarze Exp $ */
-/* $OpenBSD: fts.c,v 1.46 2014/05/25 17:47:04 tedu Exp $ */
+/* $Id: compat_fts.c,v 1.5 2014/12/11 09:05:01 schwarze Exp $ */
+/* $OpenBSD: fts.c,v 1.49 2014/11/23 00:14:22 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -146,7 +146,8 @@ fts_open(char * const *argv, int options, void *dummy)
* and ".." are all fairly nasty problems. Note, if we can't get the
* descriptor we run anyway, just more slowly.
*/
- if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = open(".", O_RDONLY, 0)) < 0)
+ if (!ISSET(FTS_NOCHDIR) &&
+ (sp->fts_rfd = open(".", O_RDONLY | O_CLOEXEC)) < 0)
SET(FTS_NOCHDIR);
if (nitems == 0)
@@ -803,7 +804,7 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, const char *path)
newfd = fd;
if (ISSET(FTS_NOCHDIR))
return (0);
- if (fd < 0 && (newfd = open(path, O_RDONLY, 0)) < 0)
+ if (fd < 0 && (newfd = open(path, O_RDONLY|O_DIRECTORY|O_CLOEXEC)) < 0)
return (-1);
if (fstat(newfd, &sb)) {
ret = -1;
diff --git a/compat_reallocarray.c b/compat_reallocarray.c
index 6e96a6ab..66151904 100644
--- a/compat_reallocarray.c
+++ b/compat_reallocarray.c
@@ -6,7 +6,8 @@ int dummy;
#else
-/* $OpenBSD: malloc.c,v 1.158 2014/04/23 15:07:27 tedu Exp $ */
+/* $Id: compat_reallocarray.c,v 1.4 2014/12/11 09:05:01 schwarze Exp $ */
+/* $OpenBSD: reallocarray.c,v 1.2 2014/12/08 03:45:00 bcook Exp $ */
/*
* Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
*
@@ -22,12 +23,17 @@ int dummy;
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+
#include <sys/types.h>
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
-#define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 4))
+/*
+ * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
+ * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
+ */
+#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
void *
reallocarray(void *optr, size_t nmemb, size_t size)
diff --git a/compat_strsep.c b/compat_strsep.c
index 348f7ebf..1df57582 100644
--- a/compat_strsep.c
+++ b/compat_strsep.c
@@ -6,7 +6,8 @@ int dummy;
#else
-/* ($)OpenBSD: strsep.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */
+/* $Id: compat_strsep.c,v 1.4 2014/12/11 09:05:01 schwarze Exp $ */
+/* $OpenBSD: strsep.c,v 1.7 2014/02/05 20:42:32 stsp Exp $ */
/*-
* Copyright (c) 1990, 1993