summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2017-08-03 13:11:44 (EDT)
committer P. J. McDermott <pj@pehjota.net>2017-08-03 13:11:44 (EDT)
commit29b44958186c4c761ada4db23caa1c3c4fa1f9bd (patch)
tree4cc4a7a212541bbe76566ca7b350c81c78b95343 /src
parentc0bd6406879ce9c2f7c6fd2693edffcf2a64d492 (diff)
try_rmdir(): Refactor
Explicitly return either 0 or 1 and slightly improve logic readability.
Diffstat (limited to 'src')
-rw-r--r--src/dir.sh10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/dir.sh b/src/dir.sh
index 979ac53..6297c2c 100644
--- a/src/dir.sh
+++ b/src/dir.sh
@@ -65,10 +65,12 @@ try_rmdir()
{
local dir="${1}"
- if dir_is_empty "${dir}"; then
- rmdir "${dir}"
- return ${?}
- else
+ if ! dir_is_empty "${dir}"; then
+ return 1
+ fi
+ if ! rmdir "${dir}"; then
return 1
fi
+
+ return 0
}