[openwrt/openwrt] hostapd: fix `UPDATE_VAL` fail in `uc_hostapd_iface_start`

LEDE Commits lede-commits at lists.infradead.org
Sun Sep 22 14:37:42 PDT 2024


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/b4dfa3b33c349be1bf74a64c3dd24c8dff98dc3c

commit b4dfa3b33c349be1bf74a64c3dd24c8dff98dc3c
Author: Jianhui Zhao <zhaojh329 at gmail.com>
AuthorDate: Wed May 15 10:45:13 2024 +0800

    hostapd: fix `UPDATE_VAL` fail in `uc_hostapd_iface_start`
    
    If the `intval` obtained from `info` is indeed 0, it cannot be set to `conf`.
    
    Signed-off-by: Jianhui Zhao <zhaojh329 at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/15495
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 package/network/services/hostapd/src/src/ap/ucode.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c
index c8a2b13a28..a5630d7eaa 100644
--- a/package/network/services/hostapd/src/src/ap/ucode.c
+++ b/package/network/services/hostapd/src/src/ap/ucode.c
@@ -533,10 +533,12 @@ uc_hostapd_iface_start(uc_vm_t *vm, size_t nargs)
 		return NULL;
 
 #define UPDATE_VAL(field, name)							\
-	if ((intval = ucv_int64_get(ucv_object_get(info, name, NULL))) &&	\
-		!errno && intval != conf->field) do {				\
-		conf->field = intval;						\
-		changed = true;							\
+	do {									\
+		intval = ucv_int64_get(ucv_object_get(info, name, NULL));	\
+		if (!errno && intval != conf->field) {				\
+			conf->field = intval;					\
+			changed = true;						\
+		}								\
 	} while(0)
 
 	conf = iface->conf;




More information about the lede-commits mailing list