Message ID | 1504205165-2090-1-git-send-email-freifunk@adrianschmutzler.de |
---|---|
State | Accepted |
Headers | show |
diff --git a/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select b/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select index c3d003f..3859817 100755 --- a/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select +++ b/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select @@ -79,10 +79,11 @@ if ping -w5 -c3 "$test_ipv4_host1" &>/dev/null || /etc/init.d/fastd reload # fastd start/stop for various situations + pidfile="/tmp/run/fastd.${project}.pid" if [ "$(ls /etc/fastd/${project}/peers/* 2>/dev/null)" ]; then - [ -d /proc/$(cat /tmp/run/fastd.${project}.pid) ] || /etc/init.d/fastd start + ([ -s "$pidfile" ] && [ -d "/proc/$(cat "$pidfile")" ]) || /etc/init.d/fastd start else - [ -d /proc/$(cat /tmp/run/fastd.${project}.pid) ] && /etc/init.d/fastd stop + ([ -s "$pidfile" ] && [ -d "/proc/$(cat "$pidfile")" ]) && /etc/init.d/fastd stop fi fi
Hi Reviewed und applied. Danke Tim Am Donnerstag, den 31.08.2017, 20:46 +0200 schrieb Adrian Schmutzler: > Bug: If /tmp/run/fastd.${project}.pid is missing, the directory > /proc/ is checked instead of /proc/{something}. > > Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> > --- > src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn- > select b/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select > index c3d003f..3859817 100755 > --- a/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select > +++ b/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select > @@ -79,10 +79,11 @@ if ping -w5 -c3 "$test_ipv4_host1" &>/dev/null || > /etc/init.d/fastd reload > > # fastd start/stop for various situations > + pidfile="/tmp/run/fastd.${project}.pid" > if [ "$(ls /etc/fastd/${project}/peers/* 2>/dev/null)" ]; > then > - [ -d /proc/$(cat /tmp/run/fastd.${project}.pid) ] || > /etc/init.d/fastd start > + ([ -s "$pidfile" ] && [ -d "/proc/$(cat "$pidfile")" ]) > || /etc/init.d/fastd start > else > - [ -d /proc/$(cat /tmp/run/fastd.${project}.pid) ] && > /etc/init.d/fastd stop > + ([ -s "$pidfile" ] && [ -d "/proc/$(cat "$pidfile")" ]) > && /etc/init.d/fastd stop > fi > > fi > -- > 2.7.4 >
Bug: If /tmp/run/fastd.${project}.pid is missing, the directory /proc/ is checked instead of /proc/{something}. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> --- src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)