1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Fix new warnings from GCC 7

This addresses the new warning types -Wformat-truncation
-Wformat-overflow that are part of -Wall, via -Wformat, in GCC 7.
This commit is contained in:
Peter Eisentraut
2017-04-11 14:13:31 -04:00
parent 2c80c3710f
commit 80a06b5acd
17 changed files with 52 additions and 52 deletions

View File

@ -41,7 +41,7 @@ char *additional_ext = NULL; /* Extension to remove from filenames */
char *archiveLocation; /* where to find the archive? */
char *restartWALFileName; /* the file from which we can restart restore */
char WALFilePath[MAXPGPATH]; /* the file path including archive */
char WALFilePath[MAXPGPATH * 2]; /* the file path including archive */
char exclusiveCleanupFileName[MAXPGPATH]; /* the oldest file we
* want to remain in
* archive */
@ -144,7 +144,7 @@ CleanupPriorWALFiles(void)
* extension that might have been chopped off before testing
* the sequence.
*/
snprintf(WALFilePath, MAXPGPATH, "%s/%s",
snprintf(WALFilePath, sizeof(WALFilePath), "%s/%s",
archiveLocation, xlde->d_name);
if (dryrun)

View File

@ -66,7 +66,7 @@ char *xlogFilePath; /* where we are going to restore to */
char *nextWALFileName; /* the file we need to get from archive */
char *restartWALFileName; /* the file from which we can restart restore */
char *priorWALFileName; /* the file we need to get from archive */
char WALFilePath[MAXPGPATH]; /* the file path including archive */
char WALFilePath[MAXPGPATH * 2]; /* the file path including archive */
char restoreCommand[MAXPGPATH]; /* run this to restore */
char exclusiveCleanupFileName[MAXPGPATH]; /* the file we need to
* get from archive */
@ -277,9 +277,9 @@ CustomizableCleanupPriorWALFiles(void)
strcmp(xlde->d_name + 8, exclusiveCleanupFileName + 8) < 0)
{
#ifdef WIN32
snprintf(WALFilePath, MAXPGPATH, "%s\\%s", archiveLocation, xlde->d_name);
snprintf(WALFilePath, sizeof(WALFilePath), "%s\\%s", archiveLocation, xlde->d_name);
#else
snprintf(WALFilePath, MAXPGPATH, "%s/%s", archiveLocation, xlde->d_name);
snprintf(WALFilePath, sizeof(WALFilePath), "%s/%s", archiveLocation, xlde->d_name);
#endif
if (debug)

View File

@ -215,8 +215,8 @@ transfer_relfile(pageCnvCtx *pageConverter, FileNameMap *map,
const char *type_suffix)
{
const char *msg;
char old_file[MAXPGPATH];
char new_file[MAXPGPATH];
char old_file[MAXPGPATH * 3];
char new_file[MAXPGPATH * 3];
int fd;
int segno;
char extent_suffix[65];