components/json-c/patches/0002-json_parse_int64.patch
author Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
Mon, 25 Apr 2016 23:38:13 -0700
changeset 5890 e3686c085735
permissions -rw-r--r--
23169134 Move json-c library to Userland 16908756 json-c package has wrong upstream-url

Patch from https://github.com/json-c/json-c/issues/173 to workaround sscanf
compatibility issue that causes test failures with Solaris libc.

Need to investigate if we should update our libc sscanf to be more compatible.

--- json-c-0.12/json_util.c.~1~ 2014-04-11 04:41:08.000000000 +0400
+++ json-c-0.12/json_util.c     2015-03-15 14:49:17.934357502 +0300
@@ -221,7 +222,7 @@
 		// Skip leading zeros, but keep at least one digit
 		while (buf_sig_digits[0] == '0' && buf_sig_digits[1] != '\0')
 			buf_sig_digits++;
-		if (num64 == 0) // assume all sscanf impl's will parse -0 to 0
+		if (buf_sig_digits[0] == '0' && buf_sig_digits[1] == '\0') 
 			orig_has_neg = 0; // "-0" is the same as just plain "0"
 
 		snprintf(buf_cmp_start, sizeof(buf_cmp), "%" PRId64, num64);