hostapd: fix `UPDATE_VAL` fail in `uc_hostapd_iface_start`
authorJianhui Zhao <zhaojh329@gmail.com>
Wed, 15 May 2024 02:45:13 +0000 (10:45 +0800)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 22 Sep 2024 21:36:46 +0000 (23:36 +0200)
If the `intval` obtained from `info` is indeed 0, it cannot be set to `conf`.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/15495
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
package/network/services/hostapd/src/src/ap/ucode.c

index c8a2b13a288d99127ab4be0fa5e1d77eba95c1cc..a5630d7eaac3540692e868819903c58d63062e4e 100644 (file)
@@ -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;