Re: [PATCH 0/2] fail compilation with strcpy
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 20, 2018, 21:50 UTC
- Message-ID
- <xmqqfu0da86b.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20180720191839.GB26403@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> I suspect it has more to do with system/libc differences between our > machines, anyway. There was discussion elsewhere in the thread about the > need to #undef before redefining. I guess this answers that question.
Yes, that is it. For now I can squash this in before pushing it out on 'pu'.
banned.h | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/banned.h b/banned.h index ae6aaaa4a9..d138f3ecf2 100644 --- a/banned.h +++ b/banned.h @@ -10,11 +10,17 @@ #define BANNED(func) sorry_##func##_is_a_banned_function() +#undef strcpy #define strcpy(x,y) BANNED(strcpy) + +#undef strncpy #define strncpy(x,y,n) BANNED(strncpy) #ifdef HAVE_VARIADIC_MACROS + +#undef sprintf #define sprintf(...) BANNED(sprintf) + #endif #endif /* BANNED_H */