[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH v2 5/6] udhcp: Fix use of trim() in udhcp_str2optset()
From:       Samuel Mendoza-Jonas <sam () mendozajonas ! com>
Date:       2018-05-14 4:29:15
Message-ID: 20180514042916.3229-6-sam () mendozajonas ! com
[Download RAW message or body]

trim() modifies the string in place if needed and returns a pointer to
the end of the resulting string. Update udhcp_str2optset() so it no
longer sets the value of 'val' to the return value of trim().

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
---
v2: Fix usage in common.c instead of modifying trim().

 networking/udhcp/common.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c
index 2fdec1d55..bc4606293 100644
--- a/networking/udhcp/common.c
+++ b/networking/udhcp/common.c
@@ -490,9 +490,10 @@ int FAST_FUNC udhcp_str2optset(const char *const_str, void *arg, const struct dh
 		int length;
 		char *val;
 
-		if (optflag->flags == OPTION_BIN)
-			val = trim(strtok(NULL, "")); /* do not split "'q w e'" */
-		else
+		if (optflag->flags == OPTION_BIN) {
+			val = strtok(NULL, ""); /* do not split "'q w e'" */
+			trim(val);
+		} else
 			val = strtok(NULL, ", \t");
 		if (!val)
 			break;
-- 
2.17.0

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic