diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-08-21 01:54:49 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-08-21 01:54:49 -0700 |
commit | 436edc6eae34b5b70371d87239d7883f41b705a2 (patch) | |
tree | c35c4532c49914f1dc69e62eda7f5157446cf5ce /compat | |
parent | Teach "git diff -p" HTML funcname patterns (diff) | |
parent | compat/snprintf.c: handle snprintf's that always return the # chars transmitted (diff) | |
download | tgif-436edc6eae34b5b70371d87239d7883f41b705a2.tar.xz |
Merge branch 'maint'
* maint:
compat/snprintf.c: handle snprintf's that always return the # chars transmitted
git-svn: fix dcommit to urls with embedded usernames
revision.h: make show_early_output an extern which is defined in revision.c
Diffstat (limited to 'compat')
-rw-r--r-- | compat/snprintf.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compat/snprintf.c b/compat/snprintf.c index 580966e56a..357e733074 100644 --- a/compat/snprintf.c +++ b/compat/snprintf.c @@ -17,6 +17,8 @@ int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap) if (maxsize > 0) { ret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap); + if (ret == maxsize-1) + ret = -1; /* Windows does not NUL-terminate if result fills buffer */ str[maxsize-1] = 0; } @@ -34,6 +36,8 @@ int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap) break; s = str; ret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap); + if (ret == maxsize-1) + ret = -1; } free(s); return ret; |