Skip to content

Commit

Permalink
High: mgmtd: Define crm_concat() if it's not declared
Browse files Browse the repository at this point in the history
  • Loading branch information
gao-yan committed Nov 29, 2012
1 parent 776f296 commit 1005407
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions configure.in
Expand Up @@ -1321,6 +1321,9 @@ if test $ac_cv_lib_crmcommon_new_ha_date = yes; then
AC_DEFINE_UNQUOTED(HAVE_NEW_HA_DATE, 1, pacemaker has new_ha_date)
fi

dnl pacemaker < 1.1.8
AC_CHECK_DECLS(crm_concat,,,[[#include <pacemaker/crm/crm.h>]])

AC_PATH_PROGS(GIT, git false)
AC_MSG_CHECKING(build revision)

Expand Down
17 changes: 17 additions & 0 deletions mgmt/daemon/mgmt_crm.c
Expand Up @@ -167,6 +167,23 @@ int cib_cache_enable = FALSE;
# define pcmk_strerror(rc) cib_error2string(rc)
#endif

#if !HAVE_DECL_CRM_CONCAT
static char *
crm_concat(const char *prefix, const char *suffix, char join)
{
int len = 0;
char *new_str = NULL;

CRM_ASSERT(prefix != NULL);
CRM_ASSERT(suffix != NULL);
len = strlen(prefix) + strlen(suffix) + 2;

new_str = calloc(1, (len));
sprintf(new_str, "%s%c%s", prefix, join, suffix);
new_str[len - 1] = 0;
return new_str;
}
#endif

#define CIB_CHECK() \
if (cib_conn == NULL) { \
Expand Down

0 comments on commit 1005407

Please sign in to comment.