summaryrefslogtreecommitdiff
path: root/wsrep
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@mariadb.com>2015-02-20 17:29:03 -0500
committerNirbhay Choubey <nirbhay@mariadb.com>2015-02-20 17:29:03 -0500
commit360ff3b0da557dc9fdbf3178ccaf084e6cb36cd0 (patch)
tree4b9a538c8156f996200211e546fc06a066d884a7 /wsrep
parent69e5f0f42395d0028e75760685cdd7588854f1df (diff)
downloadmariadb-git-360ff3b0da557dc9fdbf3178ccaf084e6cb36cd0.tar.gz
Fix for build failures on Power8
Diffstat (limited to 'wsrep')
-rw-r--r--wsrep/wsrep_loader.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/wsrep/wsrep_loader.c b/wsrep/wsrep_loader.c
index 8ae6ea962ec..0825d7e9ecf 100644
--- a/wsrep/wsrep_loader.c
+++ b/wsrep/wsrep_loader.c
@@ -39,11 +39,10 @@ static wsrep_log_cb_t logger = default_logger;
static int verify(const wsrep_t *wh, const char *iface_ver)
{
- const size_t msg_len = 128;
- char msg[msg_len];
+ char msg[128];
#define VERIFY(_p) if (!(_p)) { \
- snprintf(msg, msg_len, "wsrep_load(): verify(): %s\n", # _p); \
+ snprintf(msg, sizeof(msg), "wsrep_load(): verify(): %s\n", # _p); \
logger (WSREP_LOG_ERROR, msg); \
return EINVAL; \
}
@@ -52,7 +51,7 @@ static int verify(const wsrep_t *wh, const char *iface_ver)
VERIFY(wh->version);
if (strcmp(wh->version, iface_ver)) {
- snprintf (msg, msg_len,
+ snprintf (msg, sizeof(msg),
"provider interface version mismatch: need '%s', found '%s'",
iface_ver, wh->version);
logger (WSREP_LOG_ERROR, msg);
@@ -115,9 +114,7 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb)
int ret = 0;
void *dlh = NULL;
wsrep_loader_fun dlfun;
- const size_t msg_len = 1024;
- char msg[msg_len + 1];
- msg[msg_len] = 0;
+ char msg[1024];
if (NULL != log_cb)
logger = log_cb;
@@ -125,7 +122,7 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb)
if (!(spec && hptr))
return EINVAL;
- snprintf (msg, msg_len,
+ snprintf (msg, sizeof(msg),
"wsrep_load(): loading provider library '%s'", spec);
logger (WSREP_LOG_INFO, msg);
@@ -143,7 +140,7 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb)
}
if (!(dlh = dlopen(spec, RTLD_NOW | RTLD_LOCAL))) {
- snprintf(msg, msg_len, "wsrep_load(): dlopen(): %s", dlerror());
+ snprintf(msg, sizeof(msg), "wsrep_load(): dlopen(): %s", dlerror());
logger (WSREP_LOG_ERROR, msg);
ret = EINVAL;
goto out;
@@ -155,14 +152,14 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb)
}
if ((ret = (*dlfun)(*hptr)) != 0) {
- snprintf(msg, msg_len, "wsrep_load(): loader failed: %s",
+ snprintf(msg, sizeof(msg), "wsrep_load(): loader failed: %s",
strerror(ret));
logger (WSREP_LOG_ERROR, msg);
goto out;
}
if ((ret = verify(*hptr, WSREP_INTERFACE_VERSION)) != 0) {
- snprintf (msg, msg_len,
+ snprintf (msg, sizeof(msg),
"wsrep_load(): interface version mismatch: my version %s, "
"provider version %s", WSREP_INTERFACE_VERSION,
(*hptr)->version);
@@ -178,7 +175,7 @@ out:
free(*hptr);
*hptr = NULL;
} else {
- snprintf (msg, msg_len,
+ snprintf (msg, sizeof(msg),
"wsrep_load(): %s %s by %s loaded successfully.",
(*hptr)->provider_name, (*hptr)->provider_version,
(*hptr)->provider_vendor);