wireless: fix process handling if the pid exe is a symlink
authorFelix Fietkau <nbd@openwrt.org>
Sun, 1 Dec 2013 20:47:18 +0000 (21:47 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 1 Dec 2013 20:47:20 +0000 (21:47 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
scripts/netifd-wireless.sh

index 1af4b10a1d39521b5838d7338d58383163fb162b..e26cea5a261656d88fc303f1956ec41de520b72d 100644 (file)
@@ -158,9 +158,13 @@ _wireless_set_data() {
 
 _wireless_add_process() {
        _wdev_notify_init $CMD_PROCESS_ADD
+       local exe="$2"
+       [ -L "$exe" ] && exe="$(readlink -f "$exe")"
        json_add_int pid "$1"
-       json_add_string exe "$2"
+       json_add_string exe "$exe"
        [ -n "$3" ] && json_add_boolean required 1
+       exe2="$(readlink -f /proc/$pid/exe)"
+       [ "$exe" = "$exe2" ] && echo "WARNING (wireless_add_process): executable path $exe does not match process $1 path ($exe2)"
        _wdev_notify
 }