You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2016/12/02 14:51:22 UTC

qpid-dispatch git commit: NO-JIRA: Remove incorrect const, causing router crash with clang.

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master b4886c4d7 -> ac02ceb0a


NO-JIRA: Remove incorrect const, causing router crash with clang.

log.c module was declaring `const char level_names[]` and then casting away
constness to initialize it. The clang compiler (legally) puts the const array in
read-only memory, which caused a segfault when we attempt to initialize it.
Removed the const.


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/ac02ceb0
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/ac02ceb0
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/ac02ceb0

Branch: refs/heads/master
Commit: ac02ceb0aba0e6c8f0be48fe3afca01cc57729ec
Parents: b4886c4
Author: Alan Conway <ac...@redhat.com>
Authored: Fri Dec 2 09:48:31 2016 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Fri Dec 2 09:48:31 2016 -0500

----------------------------------------------------------------------
 src/log.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ac02ceb0/src/log.c
----------------------------------------------------------------------
diff --git a/src/log.c b/src/log.c
index 06689ef..f0b4677 100644
--- a/src/log.c
+++ b/src/log.c
@@ -199,7 +199,7 @@ static level_t levels[] = {
     LEVEL("critical", QD_LOG_CRITICAL, LOG_CRIT)
 };
 
-static const char level_names[TEXT_MAX]; /* Set up in qd_log_initialize */
+static char level_names[TEXT_MAX] = {0}; /* Set up in qd_log_initialize */
 
 /// Return NULL and set qd_error if not a valid bit.
 static const level_t* level_for_bit(int bit) {
@@ -465,8 +465,7 @@ void qd_log_initialize(void)
     DEQ_INIT(sink_list);
 
     // Set up level_names for use in error messages.
-    ZERO((char*)level_names);
-    char *begin = (char*)level_names, *end = (char*)level_names+sizeof(level_names);
+    char *begin = level_names, *end = level_names+sizeof(level_names);
     aprintf(&begin, end, "%s", levels[NONE].name);
     for (level_index_t i = NONE + 1; i < N_LEVELS; ++i)
         aprintf(&begin, end, ", %s", levels[i].name);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org