From d6201f5d8daada3d64a0a3e0038e14eebec683ce Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Wed, 3 Aug 2016 22:59:23 +0200 Subject: Imported Upstream version 1.2.4 --- clients/cli/common.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'clients/cli/common.c') diff --git a/clients/cli/common.c b/clients/cli/common.c index 0888f063..05b76564 100644 --- a/clients/cli/common.c +++ b/clients/cli/common.c @@ -415,10 +415,12 @@ nmc_parse_and_build_route (int family, char *dest = NULL, *plen = NULL; const char *next_hop = NULL; const char *canon_dest; - long int prefix = max_prefix, metric = -1; + long int prefix = max_prefix; + unsigned long int tmp_ulong; NMIPRoute *route = NULL; gboolean success = FALSE; GError *local = NULL; + gint64 metric = -1; g_return_val_if_fail (family == AF_INET || family == AF_INET6, FALSE); g_return_val_if_fail (first != NULL, FALSE); @@ -444,19 +446,21 @@ nmc_parse_and_build_route (int family, next_hop = second; else { /* 'second' can be a metric */ - if (!nmc_string_to_int (second, TRUE, 0, G_MAXUINT32, &metric)) { + if (!nmc_string_to_uint (second, TRUE, 0, G_MAXUINT32, &tmp_ulong)) { g_set_error (error, 1, 0, _("the second component of route ('%s') is neither " "a next hop address nor a metric"), second); goto finish; } + metric = tmp_ulong; } } if (third) { - if (!nmc_string_to_int (third, TRUE, 0, G_MAXUINT32, &metric)) { + if (!nmc_string_to_uint (third, TRUE, 0, G_MAXUINT32, &tmp_ulong)) { g_set_error (error, 1, 0, _("invalid metric '%s'"), third); goto finish; } + metric = tmp_ulong; } route = nm_ip_route_new (family, dest, prefix, next_hop, metric, &local); -- cgit 1.3.0-6-gf8a5