Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] Add compat/vsnprintf.c for systems that returns -1 on maxsize reached

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:20

Wayne Davison [off-list ref] writes:
I'd suggest using a longer buf, requesting a longer length (e.g. 3
instead of 1), and then making sure that the resulting buf is right
(e.g. "12" instead of "123").

		[[char buf[6];
		  if (test_vsnprintf(buf, 3, "%s", "12345") != 5
		   || strcmp(buf, "12") != 0) return 1;
		  if (snprintf(buf, 3, "%s", "12345") != 5
		   || strcmp(buf, "12") != 0) return 1]])],
That sounds like a sensible thing to do.

Other than that, the patch in

    Message-Id: [ref]

looked Ok to me.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help