diff options
author | Michal Rokos <michal.rokos@nextsoft.cz> | 2008-03-05 16:46:13 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-03-05 13:12:07 -0800 |
commit | c4582f93a263bea534288e7f7ad8937405964cd4 (patch) | |
tree | 0347f5c0606376d6ebd8e35dd4636139711fd8ac /Makefile | |
parent | bash: git-branch -d and -m lists only local branches (diff) | |
download | tgif-c4582f93a263bea534288e7f7ad8937405964cd4.tar.xz |
Add compat/snprintf.c for systems that return bogus
Some systems (namely HPUX and Windows) return -1 when maxsize in snprintf()
and in vsnprintf() is reached. So replace snprintf() and vsnprintf()
functions with our own ones that return correct value upon overflow.
[jc: verified that review comments by J6t have been incorporated, and
tightened the check to verify the resulting buffer contents, suggested
by Wayne Davison]
Signed-off-by: Michal Rokos <michal.rokos@nextsoft.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -3,6 +3,10 @@ all:: # Define V=1 to have a more verbose compile. # +# Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf() +# or vsnprintf() return -1 instead of number of characters which would +# have been written to the final string if enough space had been available. +# # Define FREAD_READS_DIRECTORIES if your are on a system which succeeds # when attempting to read from an fopen'ed directory. # @@ -629,6 +633,10 @@ endif ifdef NO_C99_FORMAT BASIC_CFLAGS += -DNO_C99_FORMAT endif +ifdef SNPRINTF_RETURNS_BOGUS + COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS + COMPAT_OBJS += compat/snprintf.o +endif ifdef FREAD_READS_DIRECTORIES COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES COMPAT_OBJS += compat/fopen.o |