From: Andrey Mazo <[email protected]>

Currently, running "udhcpc -n -b" causes udhcpc to go to background and
then exit after some time unless a lease is obtained.

It's not very useful to do so
as the calling process doesn't know
if the lease was obtained or not anyway.

The code actually tries to favor "-b" over "-n",
but doesn't clear "-n" flag while clearing "-b" after backgrounding.

So, clear "-n" flag after going into background.
This effectively makes "-b" override "-n" completely
and "-n -b" behave the same as "-b".

This allows to override default "-n" option, passed to udhcpc by ifupdown,
without recompiling busybox.

URL: https://bugs.busybox.net/11691

Signed-off-by: Andrey Mazo <[email protected]>
---
 networking/udhcp/dhcpc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index dcec8cdfd..99ff6e839 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -1485,6 +1485,8 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                                        client_background();
                                        /* do not background again! */
                                        opt = ((opt & ~OPT_b) | OPT_f);
+                                       /* do not abort after backgrounding */
+                                       opt &= ~OPT_n;
                                } else
 #endif
                                if (opt & OPT_n) { /* abort if no lease */

base-commit: e563f9e851c78f5c13cb9828ddb11ca981fd6331
-- 
2.19.2

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to