diff --git a/libs/file/is_world_accessible b/libs/file/is_world_accessible index f433da5..b3f5d3e 100644 --- a/libs/file/is_world_accessible +++ b/libs/file/is_world_accessible @@ -15,6 +15,9 @@ # limitations under the License. # +#include file/is_world_readable +#include file/is_world_executable + # file::is_world_accessible # Checks if a file or directory is world-readable and executable. # @@ -40,7 +43,7 @@ function file::is_world_accessible() { if [[ ! -d "$path" ]]; then mode=$(stat -c "%a" "$path") - if file::is_world_readable "$path"; then + if ! file::is_world_readable "$path"; then return 1 fi diff --git a/libs/file/is_world_executable b/libs/file/is_world_executable index ecb2010..ac9798b 100644 --- a/libs/file/is_world_executable +++ b/libs/file/is_world_executable @@ -33,5 +33,5 @@ # status (false). function file::is_world_executable() { local path=${1:?st argument (path) must be set} - [[ -n $(find "$path" -perm -005) ]] + [[ -n $(find "$path" -maxdepth 0 -perm -005) ]] } diff --git a/libs/file/is_world_readable b/libs/file/is_world_readable index 1977248..b968340 100644 --- a/libs/file/is_world_readable +++ b/libs/file/is_world_readable @@ -33,5 +33,5 @@ # status (false). function file::is_world_readable() { local path=${1:?st argument (path) must be set} - [[ -n $(find "$path" -perm -004) ]] + [[ -n $(find "$path" -maxdepth 0 -perm -004) ]] } diff --git a/libs/file/is_world_writable b/libs/file/is_world_writable index 272f8b9..1be1479 100644 --- a/libs/file/is_world_writable +++ b/libs/file/is_world_writable @@ -33,5 +33,5 @@ # status (false). function file::is_world_writable() { local path=${1:?st argument (path) must be set} - [[ -n $(find "$path" -perm -002) ]] + [[ -n $(find "$path" -maxdepth 0 -perm -002) ]] }