commit 380c1bb3d460fb26f53b43ec4434d32757136aba
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Mon Jun 20 18:20:45 2016 -0500

    Fix: libais,libcluster,libcrmcommon,liblrmd: don't use %z specifier
    
    Older versions of corosync don't support it when serializing/unserializing
    black boxes

Index: pacemaker/lib/ais/plugin.c
===================================================================
--- pacemaker.orig/lib/ais/plugin.c
+++ pacemaker/lib/ais/plugin.c
@@ -1387,8 +1387,9 @@ check_message_sanity(const AIS_Message *
     }
 
     AIS_CHECK(msg->header.size > sizeof(AIS_Message),
-              ais_err("Message %d size too small: %d < %zu",
-                      msg->header.id, msg->header.size, sizeof(AIS_Message));
+              ais_err("Message %d size too small: %d < %llu",
+                      msg->header.id, msg->header.size,
+                      (unsigned long long) sizeof(AIS_Message));
               return FALSE);
 
     if (sane && ais_data_len(msg) != tmp_size) {
Index: pacemaker/lib/cluster/cpg.c
===================================================================
--- pacemaker.orig/lib/cluster/cpg.c
+++ pacemaker/lib/cluster/cpg.c
@@ -166,7 +166,8 @@ crm_cs_flush(gpointer data)
 
         sent++;
         last_sent++;
-        crm_trace("CPG message sent, size=%d", iov->iov_len);
+        crm_trace("CPG message sent, size=%llu",
+                  (unsigned long long) iov->iov_len);
 
         cs_message_queue = g_list_remove(cs_message_queue, iov);
         free(iov->iov_base);
@@ -175,11 +176,13 @@ crm_cs_flush(gpointer data)
 
     queue_len -= sent;
     if (sent > 1 || cs_message_queue) {
-        crm_info("Sent %d CPG messages  (%d remaining, last=%u): %s (%d)",
-                 sent, queue_len, last_sent, ais_error2text(rc), rc);
+        crm_info("Sent %d CPG messages  (%d remaining, last=%u): %s (%lld)",
+                 sent, queue_len, last_sent, ais_error2text(rc),
+                 (long long) rc);
     } else {
-        crm_trace("Sent %d CPG messages  (%d remaining, last=%u): %s (%d)",
-                  sent, queue_len, last_sent, ais_error2text(rc), rc);
+        crm_trace("Sent %d CPG messages  (%d remaining, last=%u): %s (%lld)",
+                  sent, queue_len, last_sent, ais_error2text(rc),
+                  (long long) rc);
     }
 
     if (cs_message_queue) {
@@ -200,7 +203,8 @@ send_cpg_iov(struct iovec * iov)
     static unsigned int queued = 0;
 
     queued++;
-    crm_trace("Queueing CPG message %u (%d bytes)", queued, iov->iov_len);
+    crm_trace("Queueing CPG message %u (%llu bytes)",
+              queued, (unsigned long long) iov->iov_len);
     cs_message_queue = g_list_append(cs_message_queue, iov);
     crm_cs_flush(&pcmk_cpg_handle);
     return TRUE;
@@ -623,11 +627,13 @@ send_cluster_text(int class, const char
     iov->iov_len = msg->header.size;
 
     if (msg->compressed_size) {
-        crm_trace("Queueing CPG message %u to %s (%d bytes, %d bytes compressed payload): %.200s",
-                  msg->id, target, iov->iov_len, msg->compressed_size, data);
+        crm_trace("Queueing CPG message %u to %s (%llu bytes, %d bytes compressed payload): %.200s",
+                  msg->id, target, (unsigned long long) iov->iov_len,
+                  msg->compressed_size, data);
     } else {
-        crm_trace("Queueing CPG message %u to %s (%d bytes, %d bytes payload): %.200s",
-                  msg->id, target, iov->iov_len, msg->size, data);
+        crm_trace("Queueing CPG message %u to %s (%llu bytes, %d bytes payload): %.200s",
+                  msg->id, target, (unsigned long long) iov->iov_len,
+                  msg->size, data);
     }
     free(target);
 
Index: pacemaker/lib/common/ipc.c
===================================================================
--- pacemaker.orig/lib/common/ipc.c
+++ pacemaker/lib/common/ipc.c
@@ -500,11 +500,12 @@ crm_ipcs_flush_events(crm_client_t * c)
         sent++;
         header = event[0].iov_base;
         if (header->size_compressed) {
-            crm_trace("Event %d to %p[%d] (%d compressed bytes) sent",
-                      header->qb.id, c->ipcs, c->pid, rc);
+            crm_trace("Event %d to %p[%d] (%lld compressed bytes) sent",
+                      header->qb.id, c->ipcs, c->pid, (long long) rc);
         } else {
-            crm_trace("Event %d to %p[%d] (%d bytes) sent: %.120s",
-                      header->qb.id, c->ipcs, c->pid, rc, event[1].iov_base);
+            crm_trace("Event %d to %p[%d] (%lld bytes) sent: %.120s",
+                      header->qb.id, c->ipcs, c->pid, (long long) rc,
+                      (char *) (event[1].iov_base));
         }
 
         c->event_queue = g_list_remove(c->event_queue, event);
@@ -515,8 +516,9 @@ crm_ipcs_flush_events(crm_client_t * c)
 
     queue_len -= sent;
     if (sent > 0 || c->event_queue) {
-        crm_trace("Sent %d events (%d remaining) for %p[%d]: %s (%d)",
-                  sent, queue_len, c->ipcs, c->pid, pcmk_strerror(rc < 0 ? rc : 0), rc);
+        crm_trace("Sent %d events (%d remaining) for %p[%d]: %s (%lld)",
+                  sent, queue_len, c->ipcs, c->pid,
+                  pcmk_strerror(rc < 0 ? rc : 0), (long long) rc);
     }
 
     if (c->event_queue) {
@@ -664,7 +666,8 @@ crm_ipcs_sendv(crm_client_t * c, struct
                        header->qb.id, c->ipcs, c->pid, header->qb.size, pcmk_strerror(rc), rc);
 
         } else {
-            crm_trace("Response %d sent, %d bytes to %p[%d]", header->qb.id, rc, c->ipcs, c->pid);
+            crm_trace("Response %d sent, %lld bytes to %p[%d]",
+                      header->qb.id, (long long) rc, c->ipcs, c->pid);
         }
 
         if (flags & crm_ipc_server_free) {
Index: pacemaker/lib/common/remote.c
===================================================================
--- pacemaker.orig/lib/common/remote.c
+++ pacemaker/lib/common/remote.c
@@ -234,7 +234,7 @@ crm_send_tls(gnutls_session_t * session,
     }
 
     total_send = len;
-    crm_trace("Message size: %d", len);
+    crm_trace("Message size: %llu", (unsigned long long) len);
 
     while (TRUE) {
         rc = gnutls_record_send(*session, unsent, len);
@@ -247,7 +247,7 @@ crm_send_tls(gnutls_session_t * session,
             break;
 
         } else if (rc < len) {
-            crm_debug("Sent %d of %d bytes", rc, len);
+            crm_debug("Sent %d of %llu bytes", rc, (unsigned long long) len);
             len -= rc;
             unsent += rc;
         } else {
@@ -273,7 +273,8 @@ crm_send_plaintext(int sock, const char
     }
     total_send = len;
 
-    crm_trace("Message on socket %d: size=%d", sock, len);
+    crm_trace("Message on socket %d: size=%llu",
+              sock, (unsigned long long) len);
   retry:
     rc = write(sock, unsent, len);
     if (rc < 0) {
@@ -288,7 +289,8 @@ crm_send_plaintext(int sock, const char
         }
 
     } else if (rc < len) {
-        crm_trace("Only sent %d of %d remaining bytes", rc, len);
+        crm_trace("Only sent %d of %llu remaining bytes",
+                  rc, (unsigned long long) len);
         len -= rc;
         unsent += rc;
         goto retry;
@@ -518,7 +520,8 @@ crm_remote_recv_once(crm_remote_t * remo
     /* automatically grow the buffer when needed */
     if(remote->buffer_size < read_len) {
            remote->buffer_size = 2 * read_len;
-        crm_trace("Expanding buffer to %u bytes", remote->buffer_size);
+        crm_trace("Expanding buffer to %llu bytes",
+                  (unsigned long long) remote->buffer_size);
 
         remote->buffer = realloc_safe(remote->buffer, remote->buffer_size + 1);
         CRM_ASSERT(remote->buffer != NULL);
@@ -559,28 +562,33 @@ crm_remote_recv_once(crm_remote_t * remo
         remote->buffer_offset += rc;
         /* always null terminate buffer, the +1 to alloc always allows for this. */
         remote->buffer[remote->buffer_offset] = '\0';
-        crm_trace("Received %u more bytes, %u total", rc, remote->buffer_offset);
+        crm_trace("Received %u more bytes, %llu total",
+                  rc, (unsigned long long) remote->buffer_offset);
 
     } else if (rc == -EINTR || rc == -EAGAIN) {
         crm_trace("non-blocking, exiting read: %s (%d)", pcmk_strerror(rc), rc);
 
     } else if (rc == 0) {
-        crm_debug("EOF encoutered after %u bytes", remote->buffer_offset);
+        crm_debug("EOF encoutered after %llu bytes",
+                  (unsigned long long) remote->buffer_offset);
         return -ENOTCONN;
 
     } else {
-        crm_debug("Error receiving message after %u bytes: %s (%d)",
-                  remote->buffer_offset, pcmk_strerror(rc), rc);
+        crm_debug("Error receiving message after %llu bytes: %s (%d)",
+                  (unsigned long long) remote->buffer_offset,
+                  pcmk_strerror(rc), rc);
         return -ENOTCONN;
     }
 
     header = crm_remote_header(remote);
     if(header) {
         if(remote->buffer_offset < header->size_total) {
-            crm_trace("Read less than the advertised length: %u < %u bytes",
-                      remote->buffer_offset, header->size_total);
+            crm_trace("Read less than the advertised length: %llu < %u bytes",
+                      (unsigned long long) remote->buffer_offset,
+                      header->size_total);
         } else {
-            crm_trace("Read full message of %u bytes", remote->buffer_offset);
+            crm_trace("Read full message of %llu bytes",
+                      (unsigned long long) remote->buffer_offset);
             return remote->buffer_offset;
         }
     }
Index: pacemaker/lib/lrmd/lrmd_client.c
===================================================================
--- pacemaker.orig/lib/lrmd/lrmd_client.c
+++ pacemaker/lib/lrmd/lrmd_client.c
@@ -1746,7 +1746,8 @@ lsb_get_metadata(const char *type, char
     lsb_meta_helper_free_value(dflt_start);
     lsb_meta_helper_free_value(dflt_stop);
 
-    crm_trace("Created fake metadata: %d", strlen(*output));
+    crm_trace("Created fake metadata: %llu",
+              (unsigned long long) strlen(*output));
     return pcmk_ok;
 }
 
@@ -1888,7 +1889,8 @@ static int
 heartbeat_get_metadata(const char *type, char **output)
 {
 	*output = crm_strdup_printf(hb_metadata_template, type, type, type);
-	crm_trace("Created fake metadata: %d", strlen(*output));
+	crm_trace("Created fake metadata: %llu",
+              (unsigned long long) strlen(*output));
 	return pcmk_ok;
 }
 #endif
