@@ -295,6 +295,9 @@ static char* extract_pg_edition_str()
295295#define COMPATIBILITY_VAL_STR (macro ) { #macro, macro, 0 }
296296#define COMPATIBILITY_VAL_INT (macro ) { #macro, NULL, macro }
297297
298+ #define COMPATIBILITY_VAL_SEPARATOR "="
299+ #define COMPATIBILITY_LINE_SEPARATOR "\n"
300+
298301/*
299302 * Compose compatibility string to be sent by pg_probackup agent
300303 * through ssh and to be verified by pg_probackup peer.
@@ -303,7 +306,13 @@ static char* extract_pg_edition_str()
303306 */
304307size_t prepare_compatibility_str (char * compatibility_buf , size_t compatibility_buf_size )
305308{
306- struct { const char * name ; const char * strval ; int intval ; } compatibility_params [] = {
309+ typedef struct compatibility_param_tag {
310+ const char * name ;
311+ const char * strval ;
312+ int intval ;
313+ } compatibility_param ;
314+
315+ compatibility_param compatibility_params [] = {
307316 COMPATIBILITY_VAL_STR (PG_MAJORVERSION ),
308317 { "edition" , extract_pg_edition_str (), 0 },
309318 COMPATIBILITY_VAL_INT (SIZEOF_VOID_P ),
@@ -312,16 +321,16 @@ size_t prepare_compatibility_str(char* compatibility_buf, size_t compatibility_b
312321 size_t result_size = 0 ;
313322 * compatibility_buf = '\0' ;
314323
315- for (int i = 0 ; i < sizeof compatibility_params ; i += 2 )
324+ for (int i = 0 ; i < ( sizeof compatibility_params / sizeof ( compatibility_param )) ; i ++ )
316325 {
317326 if (compatibility_params [i ].strval != NULL )
318327 result_size += snprintf (compatibility_buf + result_size , compatibility_buf_size - result_size ,
319- "%s=%s/n" ,
328+ "%s" COMPATIBILITY_VAL_SEPARATOR "%s" COMPATIBILITY_LINE_SEPARATOR ,
320329 compatibility_params [i ].name ,
321330 compatibility_params [i ].strval );
322331 else
323332 result_size += snprintf (compatibility_buf + result_size , compatibility_buf_size - result_size ,
324- "%s=%d/n" ,
333+ "%s" COMPATIBILITY_VAL_SEPARATOR "%d" COMPATIBILITY_LINE_SEPARATOR ,
325334 compatibility_params [i ].name ,
326335 compatibility_params [i ].intval );
327336 Assert (result_size < compatibility_buf_size );
0 commit comments