From 41d6e61e7a953d6ef5e77a3271208b1b6c4e4921 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Wed, 29 Apr 2009 23:21:21 +0000 Subject: Add DEBUG_ERROR_LOCATIONS support If DEBUG_ERROR_LOCATIONS is defined, replace uses of krb5_set_error_message and krb5int_set_error with calls to the new _fl variants of those functions, and include filename and line number information in the calls. Requires C99-style variadic macros if defined. ticket: 6479 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22291 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/k5-err.h | 21 +++++++++++++++++++++ src/include/k5-int.h | 5 +++++ 2 files changed, 26 insertions(+) (limited to 'src/include') diff --git a/src/include/k5-err.h b/src/include/k5-err.h index a6dedcc88..e5fc9bddf 100644 --- a/src/include/k5-err.h +++ b/src/include/k5-err.h @@ -65,6 +65,22 @@ krb5int_vset_error (struct errinfo *ep, long code, __attribute__((__format__(__printf__, 3, 0))) #endif ; +void +krb5int_set_error_fl (struct errinfo *ep, long code, + const char *file, int line, + const char *fmt, ...) +#if !defined(__cplusplus) && (__GNUC__ > 2) + __attribute__((__format__(__printf__, 5, 6))) +#endif + ; +void +krb5int_vset_error_fl (struct errinfo *ep, long code, + const char *file, int line, + const char *fmt, va_list args) +#if !defined(__cplusplus) && (__GNUC__ > 2) + __attribute__((__format__(__printf__, 5, 0))) +#endif + ; const char * krb5int_get_error (struct errinfo *ep, long code); void @@ -74,4 +90,9 @@ krb5int_clear_error (struct errinfo *ep); void krb5int_set_error_info_callout_fn (const char *(KRB5_CALLCONV *f)(long)); +#ifdef DEBUG_ERROR_LOCATIONS +#define krb5int_set_error(ep, code, ...) \ + krb5int_set_error_fl(ep, code, __FILE__, __LINE__, __VA_ARGS__) +#endif + #endif /* K5_ERR_H */ diff --git a/src/include/k5-int.h b/src/include/k5-int.h index 5e159d9a4..de391a7d9 100644 --- a/src/include/k5-int.h +++ b/src/include/k5-int.h @@ -2797,4 +2797,9 @@ krb5int_pac_sign(krb5_context context, const krb5_keyblock *privsvr_key, krb5_data *data); +#ifdef DEBUG_ERROR_LOCATIONS +#define krb5_set_error_message(ctx, code, ...) \ + krb5_set_error_message_fl(ctx, code, __FILE__, __LINE__, __VA_ARGS__) +#endif + #endif /* _KRB5_INT_H */ -- cgit