transport-helper: replace checked snprintf with xsnprintf
We can use xsnprintf to do our truncation check with less code. The error message isn't as specific, but the point is that this isn't supposed to trigger in the first place (because our buffer is big enough to handle any int). Signed-off-by: Jeff King <peff@peff.net>
Jeff King committed
Mar 28, 2017 at 15:47 UTC
8c5acfb923a94dc746baa4eef8454cb4c4f18270
1 file changed
+1
-4
transport-helper.c
+1
-4
@@ -347,14 +347,11 @@ static int set_helper_option(struct transport *transport,
347
static void standard_options(struct transport *t)
348
{
349
char buf[16];
350
- int n;
350
int v = t->verbose;
351
352
set_helper_option(t, "progress", t->progress ? "true" : "false");
353
355
- n = snprintf(buf, sizeof(buf), "%d", v + 1);
356
- if (n >= sizeof(buf))
357
- die("impossibly large verbosity value");
354
+ xsnprintf(buf, sizeof(buf), "%d", v + 1);
355
set_helper_option(t, "verbosity", buf);
356
357
switch (t->family) {