aboutsummaryrefslogtreecommitdiff
path: root/patches/0001-fts-Avoid-d_namlen.patch
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2020-10-16 17:41:25 +0300
committerCem Keylan <cem@ckyln.com>2020-10-16 17:41:25 +0300
commite2abcdca396661cbe0ae2ddb13d5c2b85682c13a (patch)
treeacf9b5c80b645617f882c45224c6e07251711842 /patches/0001-fts-Avoid-d_namlen.patch
downloadotools-e2abcdca396661cbe0ae2ddb13d5c2b85682c13a.tar.gz
initial commit
Diffstat (limited to 'patches/0001-fts-Avoid-d_namlen.patch')
-rw-r--r--patches/0001-fts-Avoid-d_namlen.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/patches/0001-fts-Avoid-d_namlen.patch b/patches/0001-fts-Avoid-d_namlen.patch
new file mode 100644
index 0000000..acf95b9
--- /dev/null
+++ b/patches/0001-fts-Avoid-d_namlen.patch
@@ -0,0 +1,49 @@
+From b546a0ae0beb2323143aed00d05e2fdf4fef5239 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Sun, 17 Apr 2016 23:50:15 -0700
+Subject: [PATCH] fts: Avoid d_namlen
+
+---
+ lib/libc/gen/fts.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c
+index 98b3a0a39..c186b7af2 100644
+--- a/lib/libc/gen/fts.c
++++ b/lib/libc/gen/fts.c
+@@ -555,6 +555,7 @@ fts_build(FTS *sp, int type)
+ int nitems, cderrno, descend, level, nlinks, nostat, doadjust;
+ int saved_errno;
+ char *cp;
++ size_t namlen;
+
+ /* Set current node pointer. */
+ cur = sp->fts_cur;
+@@ -653,11 +654,12 @@ fts_build(FTS *sp, int type)
+ if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
+ continue;
+
+- if (!(p = fts_alloc(sp, dp->d_name, dp->d_namlen)))
++ namlen = strlen(dp->d_name);
++ if (!(p = fts_alloc(sp, dp->d_name, namlen)))
+ goto mem1;
+- if (dp->d_namlen >= maxlen) { /* include space for NUL */
++ if (namlen >= maxlen) { /* include space for NUL */
+ oldaddr = sp->fts_path;
+- if (fts_palloc(sp, dp->d_namlen +len + 1)) {
++ if (fts_palloc(sp, namlen +len + 1)) {
+ /*
+ * No more memory for path or structures. Save
+ * errno, free up the current structure and the
+@@ -683,7 +685,7 @@ mem1: saved_errno = errno;
+
+ p->fts_level = level;
+ p->fts_parent = sp->fts_cur;
+- p->fts_pathlen = len + dp->d_namlen;
++ p->fts_pathlen = len + namlen;
+ if (p->fts_pathlen < len) {
+ /*
+ * If we wrap, free up the current structure and
+--
+2.12.2
+