[openwrt/openwrt] mediatek: filogic: avoid sub-shell invovation in netdev rename loop

LEDE Commits lede-commits at lists.infradead.org
Fri May 31 05:28:38 PDT 2024


dangole pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/983222605ce6fabb036fbbd5797b6689ed082136

commit 983222605ce6fabb036fbbd5797b6689ed082136
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Thu May 30 14:38:56 2024 +0100

    mediatek: filogic: avoid sub-shell invovation in netdev rename loop
    
    Rename network devices to their label set in DT without invocation of
    a sub-shell.
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 .../linux/mediatek/filogic/base-files/lib/preinit/04_set_netdev_label | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/04_set_netdev_label b/target/linux/mediatek/filogic/base-files/lib/preinit/04_set_netdev_label
index f8b6f155de..110e023b96 100644
--- a/target/linux/mediatek/filogic/base-files/lib/preinit/04_set_netdev_label
+++ b/target/linux/mediatek/filogic/base-files/lib/preinit/04_set_netdev_label
@@ -5,8 +5,8 @@ set_netdev_labels() {
 
 	for dir in /sys/class/net/*; do
 		[ -r "$dir/of_node/label" ] || continue
-		label="$(cat "$dir/of_node/label")"
-		netdev="$(basename $dir)"
+		read -r label < "$dir/of_node/label"
+		netdev="${dir##*/}"
 		[ "$netdev" = "$label" ] && continue
 		ip link set "$netdev" name "$label"
 	done




More information about the lede-commits mailing list