Would it be simpler to do "16%"SCNx64 ?
On Wed, Dec 17, 2014 at 10:34 AM, Joe Stringer <joestrin...@nicira.com> wrote: > Commit 534a19b (dpctl: Add support for using UFID to add/del flows.) > introduced string parsing functions for UFIDs, but provided a broken > implementation where the upper 64 bits would be ignored, then the lower > 64 bits would be read into both the lower and upper UFID positions. Fix > the implementation to read the upper bits properly. > > Signed-off-by: Joe Stringer <joestrin...@nicira.com> > --- > lib/odp-util.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/lib/odp-util.c b/lib/odp-util.c > index 1dc63ef..467295e 100644 > --- a/lib/odp-util.c > +++ b/lib/odp-util.c > @@ -2005,6 +2005,7 @@ odp_ufid_from_string(const char *s_, ovs_u128 *ufid) > const char *s = s_; > > if (ovs_scan(s, "ufid:")) { > + char upper[17]; > size_t n; > > s += 5; > @@ -2017,7 +2018,8 @@ odp_ufid_from_string(const char *s_, ovs_u128 *ufid) > return -EINVAL; > } > > - if (!ovs_scan(s, "%"SCNx64, &ufid->u64.hi)) { > + ovs_strzcpy(upper, s, 17); > + if (!ovs_scan(upper, "%"SCNx64, &ufid->u64.hi)) { > return -EINVAL; > } > s += 16; > -- > 1.7.10.4 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev