Commit bd1b6fc7 authored by Tails developers's avatar Tails developers
Browse files

Use flock to prevent muliple instances of Unsafe Browser.

parent 03e5f9c9
#!/bin/sh #!/bin/sh
set -e
CMD=$(basename ${0}) CMD=$(basename ${0})
LOCK=/var/lock/${CMD}
. gettext.sh . gettext.sh
TEXTDOMAIN=${CMD} TEXTDOMAIN=${CMD}
...@@ -146,6 +149,12 @@ maybe_restart_tor () { ...@@ -146,6 +149,12 @@ maybe_restart_tor () {
fi fi
} }
# Prevent multiple instances of the script.
exec 9>${LOCK}
if ! flock -x -n 9; then
error "`gettext \"Another Unsafe Browser is currently running, or being cleaned up. Please retry in a while.\"`"
fi
# Get the DNS servers that was obtained from NetworkManager, if any... # Get the DNS servers that was obtained from NetworkManager, if any...
NM_ENV=/var/lib/NetworkManager/env NM_ENV=/var/lib/NetworkManager/env
if [ -r "${NM_ENV}" ]; then if [ -r "${NM_ENV}" ]; then
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment