[PATCH 1/2] net: dhcp: Fix return value on ctrl-c

Sascha Hauer s.hauer at pengutronix.de
Tue May 14 05:58:16 EDT 2013


the dhcp command will return with 0 when ctrl-c is pressed. Fix this to
-EINTR instead.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 net/dhcp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/dhcp.c b/net/dhcp.c
index 8233ec3..7324c94 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -767,8 +767,10 @@ static int do_dhcp(int argc, char *argv[])
 		goto out1;
 
 	while (dhcp_state != BOUND) {
-		if (ctrlc())
-			break;
+		if (ctrlc()) {
+			ret = -EINTR;
+			goto out1;
+		}
 		if (!retries) {
 			ret = -ETIMEDOUT;
 			goto out1;
-- 
1.8.2.rc2




More information about the barebox mailing list