@@ -980,7 +980,7 @@ add_coordinatorMaster(char *name, char *host, int port, int pooler, char *dir)
980980 "# End of Additon\n" ,
981981 timeStampString (date , MAXTOKEN + 1 ),
982982 port , pooler , gtmHost , atoi (gtmPort ));
983- fclose (f );
983+ pclose (f );
984984 }
985985 CleanArray (confFiles );
986986 jj = coordIdx (name );
@@ -996,7 +996,7 @@ add_coordinatorMaster(char *name, char *host, int port, int pooler, char *dir)
996996 sval (VAR_pgxcOwner ), aval (VAR_coordPgHbaEntries )[kk ]);
997997 }
998998 fprintf (f , "# End of addition\n" );
999- fclose (f );
999+ pclose (f );
10001000 }
10011001
10021002 /* Lock ddl */
@@ -1040,20 +1040,20 @@ add_coordinatorMaster(char *name, char *host, int port, int pooler, char *dir)
10401040 }
10411041 fprintf (f , "CREATE NODE %s WITH (TYPE = 'coordinator', host='%s', PORT=%d);\n" , name , host , port );
10421042 fprintf (f , "\\q\n" );
1043- fclose (f );
1043+ pclose (f );
10441044 }
10451045 }
10461046 /* Quit DDL lokkup session */
10471047 fprintf (lockf , "\\q\n" );
1048- fclose (lockf );
1048+ pclose (lockf );
10491049 if ((f = pgxc_popen_wRaw ("psql -h %s -p %d %s" , host , port , sval (VAR_defaultDatabase ))) == NULL )
10501050 elog (ERROR , "ERROR: cannot connect to the coordinator master %s.\n" , name );
10511051 else
10521052 {
10531053 fprintf (f , "ALTER NODE %s WITH (host='%s', PORT=%d);\n" , name , host , port );
10541054 fprintf (f , "select pgxc_pool_reload();\n" );
10551055 fprintf (f , "\\q\n" );
1056- fclose (f );
1056+ pclose (f );
10571057 }
10581058 return 0 ;
10591059}
@@ -1124,7 +1124,7 @@ add_coordinatorSlave(char *name, char *host, char *dir, char *archDir)
11241124 timeStampString (date , MAXPATH ),
11251125 sval (VAR_pgxcUser ), host , archDir ,
11261126 getDefaultWalSender (TRUE));
1127- fclose (f );
1127+ pclose (f );
11281128 /* pg_hba.conf for replication */
11291129 if ((f = pgxc_popen_w (aval (VAR_coordMasterServers )[idx ], "cat >> %s/pg_hba.conf" , aval (VAR_coordMasterDirs )[idx ])) == NULL )
11301130 {
@@ -1139,7 +1139,7 @@ add_coordinatorSlave(char *name, char *host, char *dir, char *archDir)
11391139 "# End of addition ===============================\n" ,
11401140 timeStampString (date , MAXPATH ),
11411141 sval (VAR_pgxcOwner ), getIpAddress (host ));
1142- fclose (f );
1142+ pclose (f );
11431143 /* Reconfigure pgxc_ctl configuration with the new slave */
11441144 /* Need an API to expand the array to desired size */
11451145 if ((extendVar (VAR_coordSlaveServers , idx , "none" ) != 0 ) ||
@@ -1257,7 +1257,7 @@ add_coordinatorSlave(char *name, char *host, char *dir, char *archDir)
12571257 /* max_wal_senders to be taken here. */
12581258 "# End of Addition\n" ,
12591259 timeStampString (date , MAXTOKEN ), atoi (aval (VAR_coordPorts )[idx ]));
1260- fclose (f );
1260+ pclose (f );
12611261 /* Update the slave recovery.conf */
12621262 if ((f = pgxc_popen_w (host , "cat >> %s/recovery.conf" , dir )) == NULL )
12631263 {
@@ -1276,7 +1276,7 @@ add_coordinatorSlave(char *name, char *host, char *dir, char *archDir)
12761276 timeStampString (date , MAXTOKEN ), aval (VAR_coordMasterServers )[idx ], aval (VAR_coordPorts )[idx ],
12771277 sval (VAR_pgxcOwner ), aval (VAR_coordNames )[idx ],
12781278 aval (VAR_coordArchLogDirs )[idx ], aval (VAR_coordArchLogDirs )[idx ]);
1279- fclose (f );
1279+ pclose (f );
12801280
12811281 /* Start the slave */
12821282 doImmediate (host , NULL , "pg_ctl start -Z coordinator -D %s -w" , dir );
@@ -1472,7 +1472,7 @@ remove_coordinatorSlave(char *name, int clean_opt)
14721472 "archive_command = ''\n"
14731473 "# End of the update\n" ,
14741474 timeStampString (date , MAXTOKEN ));
1475- fclose (f );
1475+ pclose (f );
14761476 }
14771477 doImmediate (aval (VAR_coordMasterServers )[idx ], NULL , "pg_ctl restart -Z coordinator -D %s" , aval (VAR_coordMasterDirs )[idx ]);
14781478 if (clean_opt )
@@ -1918,7 +1918,7 @@ failover_oneCoordinator(int coordIdx)
19181918 "# End of addition\n" ,
19191919 timeStampString (timestamp , MAXTOKEN ),
19201920 gtmHost , gtmPort );
1921- fclose (f );
1921+ pclose (f );
19221922
19231923 /* Restart coord Slave Server */
19241924 rc_local = doImmediate (aval (VAR_coordSlaveServers )[coordIdx ], NULL ,
@@ -2000,7 +2000,7 @@ failover_oneCoordinator(int coordIdx)
20002000 aval (VAR_coordNames )[coordIdx ],
20012001 aval (VAR_coordNames )[coordIdx ], aval (VAR_coordMasterServers )[coordIdx ], aval (VAR_coordPorts )[coordIdx ]);
20022002#endif
2003- fclose (f );
2003+ pclose (f );
20042004 }
20052005 }
20062006 /* Now update myself */
@@ -2018,7 +2018,7 @@ failover_oneCoordinator(int coordIdx)
20182018 "select pgxc_pool_reload();\n"
20192019 "\\q\n" ,
20202020 aval (VAR_coordNames )[coordIdx ], aval (VAR_coordMasterServers )[coordIdx ], aval (VAR_coordPorts )[coordIdx ]);
2021- fclose (f );
2021+ pclose (f );
20222022 return (rc );
20232023
20242024# undef checkRc
0 commit comments