diff options
| author | Hauke Mehrtens | 2026-05-23 12:40:30 +0000 |
|---|---|---|
| committer | Hauke Mehrtens | 2026-06-18 00:35:20 +0000 |
| commit | f2cfc8dd420693868c83459649e0605c79461360 (patch) | |
| tree | 69d37fc2410a7241830ea5bf1fe037884badfb06 | |
| parent | 6545d3dba743e9c9ae9aa8de64459ae585689225 (diff) | |
| download | odhcpd-f2cfc8dd420693868c83459649e0605c79461360.tar.gz | |
config: invert ipv6_pxe_from_uci() return value
ipv6_pxe_entry_new() returns the new entry on success and NULL on
allocation failure, but ipv6_pxe_from_uci() encoded that as
"non-NULL ? -1 : 0", reporting success as -1 and failure as 0. The
caller in odhcpd_reload() currently discards the value, so this never
manifested, but the function signature lies about what happened — fix
the ternary so a future caller that checks it gets the right answer.
Assisted-by: Claude:claude-opus-4-7
Link: https://github.com/openwrt/odhcpd/pull/401
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit f3743a862b3635b1c445ca71dc535e02d5994610)
| -rw-r--r-- | src/config.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/config.c b/src/config.c index beb81b8..1165605 100644 --- a/src/config.c +++ b/src/config.c @@ -2012,7 +2012,10 @@ static int ipv6_pxe_from_uci(struct uci_section* s) if (tb[IPV6_PXE_ARCH]) arch = blobmsg_get_u32(tb[IPV6_PXE_ARCH]); - return ipv6_pxe_entry_new(arch, url) ? -1 : 0; + /* ipv6_pxe_entry_new() returns the new entry on success and NULL on + * allocation failure. Mirror that into the int return code the rest + * of the module uses: success -> 0, failure -> -1. */ + return ipv6_pxe_entry_new(arch, url) ? 0 : -1; } void odhcpd_reload(void) |