Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-03-28 22:47:00 +0300
committerJunio C Hamano <gitster@pobox.com>2017-03-31 00:59:50 +0300
commit8c5acfb923a94dc746baa4eef8454cb4c4f18270 (patch)
treee35bb4589dd528675946667e1f0300d16f89ac68 /transport-helper.c
parent1a168e5c86d2c6cbb57429473357bdf1acdec63c (diff)
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>
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/transport-helper.c b/transport-helper.c
index dc90a1fb769..36408046eb2 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) {