Skip to content

Commit 2bad3f3

Browse files
author
Daniel Ruthardt
authored
🐛 Fix significant issues highlighted thanks to testing (#28)
1 parent 6fe1c3c commit 2bad3f3

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

libs/file/is_world_accessible

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
# limitations under the License.
1616
#
1717

18+
#include file/is_world_readable
19+
#include file/is_world_executable
20+
1821
# file::is_world_accessible
1922
# Checks if a file or directory is world-readable and executable.
2023
#
@@ -40,7 +43,7 @@ function file::is_world_accessible() {
4043

4144
if [[ ! -d "$path" ]]; then
4245
mode=$(stat -c "%a" "$path")
43-
if file::is_world_readable "$path"; then
46+
if ! file::is_world_readable "$path"; then
4447
return 1
4548
fi
4649

libs/file/is_world_executable

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@
3333
# status (false).
3434
function file::is_world_executable() {
3535
local path=${1:?st argument (path) must be set}
36-
[[ -n $(find "$path" -perm -005) ]]
36+
[[ -n $(find "$path" -maxdepth 0 -perm -005) ]]
3737
}

libs/file/is_world_readable

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@
3333
# status (false).
3434
function file::is_world_readable() {
3535
local path=${1:?st argument (path) must be set}
36-
[[ -n $(find "$path" -perm -004) ]]
36+
[[ -n $(find "$path" -maxdepth 0 -perm -004) ]]
3737
}

libs/file/is_world_writable

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@
3333
# status (false).
3434
function file::is_world_writable() {
3535
local path=${1:?st argument (path) must be set}
36-
[[ -n $(find "$path" -perm -002) ]]
36+
[[ -n $(find "$path" -maxdepth 0 -perm -002) ]]
3737
}

0 commit comments

Comments
 (0)