I have a piece of code that checks for access to a non-root user to perform a recursive chown operation on a directory with its child directory having 0 permissions(all permission bits set to zero)
It uses the` fts_info` flags of FTSENT structure returned by fts_read().For s390x architecture(big endian), it is seen that the value of fts_info for the unreadable directory is set as 6 (FTS_DP) corresponding to postorder directory instead of 6 (FTS_DNR) which is an Unreadable directory . For x86 architecture (little endian), expected behaviour is observed as fts_info is FTS_DNR. Architecture: s390x Version: 8.25-2ubuntu2 Here is the test code os::mkdir("one/two")); os::chmod("one/two", 0)); // Recursive chown should now fail to fully recurse due to // the lack of permission on "one/two". EXPECT_ERROR(os::chown(uid.get(), gid.get(), "one", true)); EXPECT_ERROR(os::chown(uid.get(), gid.get(), "one/two", true)); I am using fts_info for the above test as shown below char* path_[] = {const_cast<char*>(path.c_str()), nullptr}; FTS* tree = ::fts_open( path_, FTS_NOCHDIR | FTS_PHYSICAL, nullptr); if (tree == nullptr) { return ErrnoError(); } FTSENT *node; while ((node = ::fts_read(tree)) != nullptr) { switch (node->fts_info) { Best, Prajakta Bhatekar <prajakta_bhate...@persistent.com> DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.