From: Jeff King Date: Tue, 28 Mar 2017 19:47:00 +0000 (-0400) Subject: transport-helper: replace checked snprintf with xsnprintf X-Git-Tag: v2.13.0-rc0~28^2~2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/8c5acfb923a94dc746baa4eef8454cb4c4f18270?ds=inline;hp=--cc 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 --- 8c5acfb923a94dc746baa4eef8454cb4c4f18270 diff --git a/transport-helper.c b/transport-helper.c index dc90a1fb76..36408046eb 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -347,14 +347,11 @@ static int set_helper_option(struct transport *transport, static void standard_options(struct transport *t) { char buf[16]; - int n; int v = t->verbose; set_helper_option(t, "progress", t->progress ? "true" : "false"); - n = snprintf(buf, sizeof(buf), "%d", v + 1); - if (n >= sizeof(buf)) - die("impossibly large verbosity value"); + xsnprintf(buf, sizeof(buf), "%d", v + 1); set_helper_option(t, "verbosity", buf); switch (t->family) {