From: Arun Prakash Jana <engineerarun@gmail.com>
Date: Sat, 18 Apr 2020 09:38:23 +0000 (+0530)
Subject: Fix listing files directly under /
X-Git-Tag: v3.2~116
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=12df1ab083d9692d97c2bf248000cc5e94a0445d;p=nnn.git

Fix listing files directly under /
---

diff --git a/src/nnn.c b/src/nnn.c
index a49aed9a..5f7b5ac2 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -6301,6 +6301,10 @@ static char *make_tmp_tree(char **paths, ssize_t entries, const char *prefix)
 	/* Points right after the base tmp dir */
 	tmp += 10;
 
+	/* handle the case where files are directly under / */
+	if (!prefix[1] && (prefix[0] == '/'))
+		len = 0;
+
 	if (!mkdtemp(tmpdir)) {
 		free(tmpdir);