[PATCH iproute2 3/3] tc/f_u32: fix const strchr() warning
Stephen Hemminger <[email protected]>
| Newsgroups | org.kernel.vger.netdev |
|---|---|
| Message-ID | <[email protected]> |
Newer GCC propogates const char across strchr() which requires spliting temp variable. Signed-off-by: Stephen Hemminger <[email protected]> --- tc/f_u32.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tc/f_u32.c b/tc/f_u32.c index 088d744e..ae285146 100644 --- a/tc/f_u32.c +++ b/tc/f_u32.c @@ -41,13 +41,15 @@ static void explain(void) static int get_u32_handle(__u32 *handle, const char *str) { __u32 htid = 0, hash = 0, nodeid = 0; - char *tmp = strchr(str, ':'); + const char *colon = strchr(str, ':'); + char *tmp; - if (tmp == NULL) { + if (colon == NULL) { if (memcmp("0x", str, 2) == 0) return get_u32(handle, str, 16); return -1; } + htid = strtoul(str, &tmp, 16); if (tmp == str && *str != ':' && *str != 0) return -1; -- 2.53.0