From 24863c9106cdf45cd655b5dc45057a34ac78f434 Mon Sep 17 00:00:00 2001
From: obarun <eric@obarun.org>
Date: Mon, 6 Jan 2020 20:55:30 +1100
Subject: [PATCH] pass through scan_mode instead of dir_search

---
 src/66/66-tree.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/66/66-tree.c b/src/66/66-tree.c
index b78e9b7f..2247c684 100644
--- a/src/66/66-tree.c
+++ b/src/66/66-tree.c
@@ -337,13 +337,13 @@ int set_rules(char const *tree,uid_t *uids, size_t uidn,unsigned int what)
 		uint32_pack(pack,uids[i+1]) ;
 		pack[uint_fmt(pack,uids[i+1])] = 0 ;
 		char ut[treelen + SS_RULES_LEN + 1 + uint_fmt(pack,uids[i+1]) + 1] ;
-		r = dir_search(tmp,pack,S_IFREG) ;
-		if (r)
+		memcpy(ut,tmp,treelen + SS_RULES_LEN) ;
+		memcpy(ut + treelen + SS_RULES_LEN,"/",1) ;
+		memcpy(ut + treelen + SS_RULES_LEN + 1,pack,uint_fmt(pack,uids[i+1])) ;
+		ut[treelen + SS_RULES_LEN + 1 + uint_fmt(pack,uids[i + 1])] = 0 ;
+		r = scan_mode(tmp,S_IFREG) ;
+		if (r == 1)
 		{
-			memcpy(ut,tmp,treelen + SS_RULES_LEN) ;
-			memcpy(ut + treelen + SS_RULES_LEN,"/",1) ;
-			memcpy(ut + treelen + SS_RULES_LEN + 1,pack,uint_fmt(pack,uids[i+1])) ;
-			ut[treelen + SS_RULES_LEN + 1 + uint_fmt(pack,uids[i + 1])] = 0 ;
 			log_trace("unlink: ",ut) ;
 			r = unlink(ut) ;
 			if (r == -1) return 0 ;
-- 
GitLab