@@ -147,7 +147,7 @@ static void create_dirs( const char *path )
147147 * whole tree.
148148 *
149149 */
150- static void traverse_dir (void **state, const QString &dir, int *cnt)
150+ static void traverse_dir (void **state, const QString &dir, int *cnt, bool checkPermissionsValidity )
151151{
152152 csync_vio_handle_t *dh = nullptr ;
153153 std::unique_ptr<csync_file_stat_t > dirent;
@@ -161,7 +161,7 @@ static void traverse_dir(void **state, const QString &dir, int *cnt)
161161 assert_non_null (dh);
162162
163163 OCC::Vfs *vfs = nullptr ;
164- while ( (dirent = csync_vio_local_readdir (dh, vfs)) ) {
164+ while ( (dirent = csync_vio_local_readdir (dh, vfs, checkPermissionsValidity )) ) {
165165 assert_non_null (dirent.get ());
166166 if (!dirent->original_path .isEmpty ()) {
167167 sv->ignored_dir = dirent->original_path ;
@@ -190,7 +190,7 @@ static void traverse_dir(void **state, const QString &dir, int *cnt)
190190 }
191191 output (subdir_out.constData ());
192192 if ( is_dir ) {
193- traverse_dir (state, QString::fromUtf8 (subdir), cnt);
193+ traverse_dir (state, QString::fromUtf8 (subdir), cnt, checkPermissionsValidity );
194194 }
195195 }
196196
@@ -210,11 +210,12 @@ static void check_readdir_shorttree(void **state)
210210{
211211 auto sv = (statevar*) *state;
212212
213+ bool checkPermissionsValidity = true ;
213214 const char *t1 = " alibaba/und/die/vierzig/räuber/" ;
214215 create_dirs ( t1 );
215216 int files_cnt = 0 ;
216217
217- traverse_dir (state, CSYNC_TEST_DIR, &files_cnt);
218+ traverse_dir (state, CSYNC_TEST_DIR, &files_cnt, checkPermissionsValidity );
218219
219220 assert_string_equal (sv->result .constData (),
220221 QString::fromUtf8 (" <DIR> %1/alibaba"
@@ -233,14 +234,15 @@ static void check_readdir_with_content(void **state)
233234 auto sv = (statevar*) *state;
234235 int files_cnt = 0 ;
235236
237+ bool checkPermissionsValidity = true ;
236238 const char *t1 = " warum/nur/40/Räuber/" ;
237239 create_dirs ( t1 );
238240
239241 create_file ( t1, " Räuber Max.txt" , " Der Max ist ein schlimmer finger" );
240242 create_file ( t1, " пя́тница.txt" , " Am Freitag tanzt der Ürk" );
241243
242244
243- traverse_dir (state, CSYNC_TEST_DIR, &files_cnt);
245+ traverse_dir (state, CSYNC_TEST_DIR, &files_cnt, checkPermissionsValidity );
244246
245247 assert_string_equal (sv->result .constData (),
246248 QString::fromUtf8 (" <DIR> %1/warum"
@@ -259,6 +261,8 @@ static void check_readdir_longtree(void **state)
259261{
260262 auto sv = (statevar*) *state;
261263
264+ bool checkPermissionsValidity = true ;
265+
262266 /* Strange things here: Compilers only support strings with length of 4k max.
263267 * The expected result string is longer, so it needs to be split up in r1, r2 and r3
264268 */
@@ -318,7 +322,7 @@ static void check_readdir_longtree(void **state)
318322 /* assemble the result string ... */
319323 const auto result = (r1 + r2 + r3).toUtf8 ();
320324 int files_cnt = 0 ;
321- traverse_dir (state, CSYNC_TEST_DIR, &files_cnt);
325+ traverse_dir (state, CSYNC_TEST_DIR, &files_cnt, checkPermissionsValidity );
322326 assert_int_equal (files_cnt, 0 );
323327 /* and compare. */
324328 assert_string_equal (sv->result .constData (), result.constData ());
@@ -333,6 +337,7 @@ static void check_readdir_bigunicode(void **state)
333337// 3: ? ASCII: 191 - BF
334338// 4: ASCII: 32 - 20
335339
340+ bool checkPermissionsValidity = true ;
336341 QString p = QStringLiteral (" %1/%2" ).arg (CSYNC_TEST_DIR, QStringLiteral (" goodone/" ));
337342 int rc = oc_mkdir (p);
338343 assert_int_equal (rc, 0 );
@@ -344,7 +349,7 @@ static void check_readdir_bigunicode(void **state)
344349 assert_int_equal (rc, 0 );
345350
346351 int files_cnt = 0 ;
347- traverse_dir (state, CSYNC_TEST_DIR, &files_cnt);
352+ traverse_dir (state, CSYNC_TEST_DIR, &files_cnt, checkPermissionsValidity );
348353 const auto expected_result = QStringLiteral (" <DIR> %1/goodone"
349354 " <DIR> %1/goodone/ugly\xEF\xBB\xBF\x32 .txt" )
350355 .arg (CSYNC_TEST_DIR);
0 commit comments