Ver código fonte

cfgtool: Use CS_PRI_NODE_ID for formatting nodeid

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Jan Friesse 4 anos atrás
pai
commit
49999d0692
2 arquivos alterados com 3 adições e 2 exclusões
  1. 1 0
      include/corosync/corotypes.h
  2. 2 2
      tools/corosync-cfgtool.c

+ 1 - 0
include/corosync/corotypes.h

@@ -57,6 +57,7 @@ typedef int64_t cs_time_t;
 #define CS_MAX(x, y) (((x) > (y)) ? (x) : (y))
 
 #define CS_PRI_NODE_ID		"%" PRIu32
+#define CS_PRI_NODE_ID_PADDED	"%10" PRIu32
 #define CS_PRI_RING_ID_SEQ	"%" PRIx64
 #define CS_PRI_RING_ID		"%" PRIx32 ".%" PRIx64
 /**

+ 2 - 2
tools/corosync-cfgtool.c

@@ -240,7 +240,7 @@ nodestatusget_do (enum user_action action, int brief)
 			if (result == CS_OK) {
 				/* Only display node info if it is reachable (and not us) */
 				if (node_status.reachable && node_status.nodeid != local_nodeid) {
-					printf("nodeid: %d", node_status.nodeid);
+					printf("nodeid: " CS_PRI_NODE_ID "", node_status.nodeid);
 					printf(" reachable");
 					if (node_status.remote) {
 						printf(" remote");
@@ -311,7 +311,7 @@ nodestatusget_do (enum user_action action, int brief)
 				} else {
 					printf("\tstatus:\n");
 					for (j=0; j<s; j++) {
-						printf("\t\tnodeid: %3d:\t", node_info[j].nodeid);
+						printf("\t\tnodeid: " CS_PRI_NODE_ID_PADDED ":\t", node_info[j].nodeid);
 						if (j == local_nodeid_index) {
 							printf("localhost");
 						} else {