Adds security if a false positive is detected

* Adds security if a false positive is detected:
  * if the command "grep -qs "$gbgmp" /proc/mounts;" returns a false positive.
  "rm -d" will return an error if the directory is not empty.
This commit is contained in:
Antynea
2021-09-24 12:12:43 +02:00
committed by GitHub
parent b346727219
commit 544d2e84ac

View File

@@ -155,7 +155,11 @@ if [[ -d "$gbgmp" ]]; then
printf " Success\n" >&2;
fi
done
[[ "$wait" != true ]] && rm -r "$gbgmp" # If mount point is empty or unmounted, delete residual folder.
if [[ "$wait" != true ]]; then
if ! rm -d "$gbgmp" >/dev/null 2>&1; then
printf "Unable to delete %s: Device or ressource is busy" "$gbgmp" >&2;
fi
fi
fi
}