summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compat_fts.c7
-rw-r--r--compat_reallocarray.c10
-rw-r--r--compat_strsep.c3
3 files changed, 14 insertions, 6 deletions
diff --git a/compat_fts.c b/compat_fts.c
index 9d1393c0..31c5709f 100644
--- a/compat_fts.c
+++ b/compat_fts.c
@@ -7,7 +7,7 @@ int dummy;
#else
/* $Id$ */
-/* $OpenBSD: fts.c,v 1.46 2014/05/25 17:47:04 tedu 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..36ee47ab 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$ */
+/* $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..2b422cf4 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$ */
+/* $OpenBSD: strsep.c,v 1.7 2014/02/05 20:42:32 stsp Exp $ */
/*-
* Copyright (c) 1990, 1993