Skip to content

Commit

Permalink
Adds security if a false positive is detected
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
Antynea authored Sep 24, 2021
1 parent b346727 commit 544d2e8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion 41_snapshots-btrfs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 544d2e8

Please sign in to comment.