[30014] in CVS-changelog-for-Kerberos-V5
krb5 commit: Log failure details for mutex errors
daemon@ATHENA.MIT.EDU (Greg Hudson)
Wed Aug 9 16:47:40 2017
Date: Wed, 9 Aug 2017 16:47:35 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-Id: <201708092047.v79KlZKW006996@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu
https://github.com/krb5/krb5/commit/70321d39b3043952f8567d95a36a22dfc74da1a8
commit 70321d39b3043952f8567d95a36a22dfc74da1a8
Author: Robbie Harwood <rharwood@redhat.com>
Date: Tue Aug 8 18:24:32 2017 -0400
Log failure details for mutex errors
Log only when assertions themselves are enabled in order to keep code
small.
src/include/k5-thread.h | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/include/k5-thread.h b/src/include/k5-thread.h
index 3e3901d..a310123 100644
--- a/src/include/k5-thread.h
+++ b/src/include/k5-thread.h
@@ -134,6 +134,10 @@
More to be added, perhaps. */
#include <assert.h>
+#ifndef NDEBUG
+#include <stdio.h>
+#include <string.h>
+#endif
/* The mutex structure we use, k5_mutex_t, is defined to some
OS-specific bits. The use of multiple layers of typedefs are an
@@ -363,12 +367,24 @@ static inline int k5_mutex_finish_init(k5_mutex_t *m)
static inline void k5_mutex_lock(k5_mutex_t *m)
{
int r = k5_os_mutex_lock(m);
+#ifndef NDEBUG
+ if (r != 0) {
+ fprintf(stderr, "k5_mutex_lock: Received error %d (%s)\n",
+ r, strerror(r));
+ }
+#endif
assert(r == 0);
}
static inline void k5_mutex_unlock(k5_mutex_t *m)
{
int r = k5_os_mutex_unlock(m);
+#ifndef NDEBUG
+ if (r != 0) {
+ fprintf(stderr, "k5_mutex_unlock: Received error %d (%s)\n",
+ r, strerror(r));
+ }
+#endif
assert(r == 0);
}
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5