Browse Source

openfortivpn: don't report error if symlink already exists

If two openfortivpn scripts are started at the same time, a race
condition can occur where the conditional evaluates to true, but the
symlink exists by the time the other script tries to create it

Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
lilik-openwrt-22.03
Aaron Goodman 4 years ago
parent
commit
d8b71f45a8
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      net/openfortivpn/files/openfortivpn.sh

+ 2
- 2
net/openfortivpn/files/openfortivpn.sh View File

@ -104,7 +104,7 @@ proto_openfortivpn_setup() {
[ -n "$username" ] && append_args -u "$username" [ -n "$username" ] && append_args -u "$username"
[ -n "$password" ] && { [ -n "$password" ] && {
umask 077 umask 077
mkdir -p /var/etc
mkdir -p '/var/etc/openfortivpn'
pwfile="/var/etc/openfortivpn/$config.passwd" pwfile="/var/etc/openfortivpn/$config.passwd"
echo "$password" > "$pwfile" echo "$password" > "$pwfile"
} }
@ -112,7 +112,7 @@ proto_openfortivpn_setup() {
[ -n "$local_ip" ] || local_ip=192.0.2.1 [ -n "$local_ip" ] || local_ip=192.0.2.1
[ -e '/etc/ppp/peers' ] || mkdir -p '/etc/ppp/peers' [ -e '/etc/ppp/peers' ] || mkdir -p '/etc/ppp/peers'
[ -e '/etc/ppp/peers/openfortivpn' ] || { [ -e '/etc/ppp/peers/openfortivpn' ] || {
ln -s -T '/var/etc/openfortivpn/peers' '/etc/ppp/peers/openfortivpn'
ln -s -T '/var/etc/openfortivpn/peers' '/etc/ppp/peers/openfortivpn' 2> /dev/null
mkdir -p '/var/etc/openfortivpn/peers' mkdir -p '/var/etc/openfortivpn/peers'
} }


Loading…
Cancel
Save