mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +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:
		@@ -57,7 +57,7 @@ char	   *xlogFilePath;		/* where we are going to restore to */
 | 
				
			|||||||
char	   *nextWALFileName;	/* the file we need to get from archive */
 | 
					char	   *nextWALFileName;	/* the file we need to get from archive */
 | 
				
			||||||
char	   *restartWALFileName; /* the file from which we can restart restore */
 | 
					char	   *restartWALFileName; /* the file from which we can restart restore */
 | 
				
			||||||
char	   *priorWALFileName;	/* the file we need to get from archive */
 | 
					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		restoreCommand[MAXPGPATH];	/* run this to restore */
 | 
				
			||||||
char		exclusiveCleanupFileName[MAXFNAMELEN];		/* the file we need to
 | 
					char		exclusiveCleanupFileName[MAXFNAMELEN];		/* the file we need to
 | 
				
			||||||
														 * get from archive */
 | 
																			 * get from archive */
 | 
				
			||||||
@@ -259,9 +259,9 @@ CustomizableCleanupPriorWALFiles(void)
 | 
				
			|||||||
				  strcmp(xlde->d_name + 8, exclusiveCleanupFileName + 8) < 0)
 | 
									  strcmp(xlde->d_name + 8, exclusiveCleanupFileName + 8) < 0)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
#ifdef WIN32
 | 
					#ifdef WIN32
 | 
				
			||||||
					snprintf(WALFilePath, MAXPGPATH, "%s\\%s", archiveLocation, xlde->d_name);
 | 
										snprintf(WALFilePath, sizeof(WALFilePath), "%s\\%s", archiveLocation, xlde->d_name);
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
					snprintf(WALFilePath, MAXPGPATH, "%s/%s", archiveLocation, xlde->d_name);
 | 
										snprintf(WALFilePath, sizeof(WALFilePath), "%s/%s", archiveLocation, xlde->d_name);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					if (debug)
 | 
										if (debug)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1194,7 +1194,7 @@ CheckPointLogicalRewriteHeap(void)
 | 
				
			|||||||
	XLogRecPtr	redo;
 | 
						XLogRecPtr	redo;
 | 
				
			||||||
	DIR		   *mappings_dir;
 | 
						DIR		   *mappings_dir;
 | 
				
			||||||
	struct dirent *mapping_de;
 | 
						struct dirent *mapping_de;
 | 
				
			||||||
	char		path[MAXPGPATH];
 | 
						char		path[MAXPGPATH + 20];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * We start of with a minimum of the last redo pointer. No new decoding
 | 
						 * We start of with a minimum of the last redo pointer. No new decoding
 | 
				
			||||||
@@ -1225,7 +1225,7 @@ CheckPointLogicalRewriteHeap(void)
 | 
				
			|||||||
			strcmp(mapping_de->d_name, "..") == 0)
 | 
								strcmp(mapping_de->d_name, "..") == 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		snprintf(path, MAXPGPATH, "pg_logical/mappings/%s", mapping_de->d_name);
 | 
							snprintf(path, sizeof(path), "pg_logical/mappings/%s", mapping_de->d_name);
 | 
				
			||||||
		if (lstat(path, &statbuf) == 0 && !S_ISREG(statbuf.st_mode))
 | 
							if (lstat(path, &statbuf) == 0 && !S_ISREG(statbuf.st_mode))
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3941,7 +3941,7 @@ CleanupBackupHistory(void)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	DIR		   *xldir;
 | 
						DIR		   *xldir;
 | 
				
			||||||
	struct dirent *xlde;
 | 
						struct dirent *xlde;
 | 
				
			||||||
	char		path[MAXPGPATH];
 | 
						char		path[MAXPGPATH + sizeof(XLOGDIR)];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	xldir = AllocateDir(XLOGDIR);
 | 
						xldir = AllocateDir(XLOGDIR);
 | 
				
			||||||
	if (xldir == NULL)
 | 
						if (xldir == NULL)
 | 
				
			||||||
@@ -3959,7 +3959,7 @@ CleanupBackupHistory(void)
 | 
				
			|||||||
				ereport(DEBUG2,
 | 
									ereport(DEBUG2,
 | 
				
			||||||
				(errmsg("removing transaction log backup history file \"%s\"",
 | 
									(errmsg("removing transaction log backup history file \"%s\"",
 | 
				
			||||||
						xlde->d_name)));
 | 
											xlde->d_name)));
 | 
				
			||||||
				snprintf(path, MAXPGPATH, XLOGDIR "/%s", xlde->d_name);
 | 
									snprintf(path, sizeof(path), XLOGDIR "/%s", xlde->d_name);
 | 
				
			||||||
				unlink(path);
 | 
									unlink(path);
 | 
				
			||||||
				XLogArchiveCleanup(xlde->d_name);
 | 
									XLogArchiveCleanup(xlde->d_name);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -10061,7 +10061,7 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p,
 | 
				
			|||||||
		/* Collect information about all tablespaces */
 | 
							/* Collect information about all tablespaces */
 | 
				
			||||||
		while ((de = ReadDir(tblspcdir, "pg_tblspc")) != NULL)
 | 
							while ((de = ReadDir(tblspcdir, "pg_tblspc")) != NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			char		fullpath[MAXPGPATH];
 | 
								char		fullpath[MAXPGPATH + 10];
 | 
				
			||||||
			char		linkpath[MAXPGPATH];
 | 
								char		linkpath[MAXPGPATH];
 | 
				
			||||||
			char	   *relpath = NULL;
 | 
								char	   *relpath = NULL;
 | 
				
			||||||
			int			rllen;
 | 
								int			rllen;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -569,7 +569,7 @@ pgstat_reset_remove_files(const char *directory)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	DIR		   *dir;
 | 
						DIR		   *dir;
 | 
				
			||||||
	struct dirent *entry;
 | 
						struct dirent *entry;
 | 
				
			||||||
	char		fname[MAXPGPATH];
 | 
						char		fname[MAXPGPATH * 2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dir = AllocateDir(directory);
 | 
						dir = AllocateDir(directory);
 | 
				
			||||||
	while ((entry = ReadDir(dir, directory)) != NULL)
 | 
						while ((entry = ReadDir(dir, directory)) != NULL)
 | 
				
			||||||
@@ -599,7 +599,7 @@ pgstat_reset_remove_files(const char *directory)
 | 
				
			|||||||
			strcmp(entry->d_name + nchars, "stat") != 0)
 | 
								strcmp(entry->d_name + nchars, "stat") != 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		snprintf(fname, MAXPGPATH, "%s/%s", directory,
 | 
							snprintf(fname, sizeof(fname), "%s/%s", directory,
 | 
				
			||||||
				 entry->d_name);
 | 
									 entry->d_name);
 | 
				
			||||||
		unlink(fname);
 | 
							unlink(fname);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -888,7 +888,7 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces,
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	DIR		   *dir;
 | 
						DIR		   *dir;
 | 
				
			||||||
	struct dirent *de;
 | 
						struct dirent *de;
 | 
				
			||||||
	char		pathbuf[MAXPGPATH];
 | 
						char		pathbuf[MAXPGPATH * 2];
 | 
				
			||||||
	struct stat statbuf;
 | 
						struct stat statbuf;
 | 
				
			||||||
	int64		size = 0;
 | 
						int64		size = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -940,7 +940,7 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces,
 | 
				
			|||||||
						 "and should not be used. "
 | 
											 "and should not be used. "
 | 
				
			||||||
						 "Try taking another online backup.")));
 | 
											 "Try taking another online backup.")));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		snprintf(pathbuf, MAXPGPATH, "%s/%s", path, de->d_name);
 | 
							snprintf(pathbuf, sizeof(pathbuf), "%s/%s", path, de->d_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* Skip postmaster.pid and postmaster.opts in the data directory */
 | 
							/* Skip postmaster.pid and postmaster.opts in the data directory */
 | 
				
			||||||
		if (strcmp(pathbuf, "./postmaster.pid") == 0 ||
 | 
							if (strcmp(pathbuf, "./postmaster.pid") == 0 ||
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2650,7 +2650,7 @@ StartupReorderBuffer(void)
 | 
				
			|||||||
	while ((logical_de = ReadDir(logical_dir, "pg_replslot")) != NULL)
 | 
						while ((logical_de = ReadDir(logical_dir, "pg_replslot")) != NULL)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		struct stat statbuf;
 | 
							struct stat statbuf;
 | 
				
			||||||
		char		path[MAXPGPATH];
 | 
							char		path[MAXPGPATH * 2 + 12];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (strcmp(logical_de->d_name, ".") == 0 ||
 | 
							if (strcmp(logical_de->d_name, ".") == 0 ||
 | 
				
			||||||
			strcmp(logical_de->d_name, "..") == 0)
 | 
								strcmp(logical_de->d_name, "..") == 0)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1831,7 +1831,7 @@ CheckPointSnapBuild(void)
 | 
				
			|||||||
	XLogRecPtr	redo;
 | 
						XLogRecPtr	redo;
 | 
				
			||||||
	DIR		   *snap_dir;
 | 
						DIR		   *snap_dir;
 | 
				
			||||||
	struct dirent *snap_de;
 | 
						struct dirent *snap_de;
 | 
				
			||||||
	char		path[MAXPGPATH];
 | 
						char		path[MAXPGPATH + 21];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * We start of with a minimum of the last redo pointer. No new replication
 | 
						 * We start of with a minimum of the last redo pointer. No new replication
 | 
				
			||||||
@@ -1858,7 +1858,7 @@ CheckPointSnapBuild(void)
 | 
				
			|||||||
			strcmp(snap_de->d_name, "..") == 0)
 | 
								strcmp(snap_de->d_name, "..") == 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		snprintf(path, MAXPGPATH, "pg_logical/snapshots/%s", snap_de->d_name);
 | 
							snprintf(path, sizeof(path), "pg_logical/snapshots/%s", snap_de->d_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (lstat(path, &statbuf) == 0 && !S_ISREG(statbuf.st_mode))
 | 
							if (lstat(path, &statbuf) == 0 && !S_ISREG(statbuf.st_mode))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -918,13 +918,13 @@ StartupReplicationSlots(void)
 | 
				
			|||||||
	while ((replication_de = ReadDir(replication_dir, "pg_replslot")) != NULL)
 | 
						while ((replication_de = ReadDir(replication_dir, "pg_replslot")) != NULL)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		struct stat statbuf;
 | 
							struct stat statbuf;
 | 
				
			||||||
		char		path[MAXPGPATH];
 | 
							char		path[MAXPGPATH + 12];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (strcmp(replication_de->d_name, ".") == 0 ||
 | 
							if (strcmp(replication_de->d_name, ".") == 0 ||
 | 
				
			||||||
			strcmp(replication_de->d_name, "..") == 0)
 | 
								strcmp(replication_de->d_name, "..") == 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		snprintf(path, MAXPGPATH, "pg_replslot/%s", replication_de->d_name);
 | 
							snprintf(path, sizeof(path), "pg_replslot/%s", replication_de->d_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* we're only creating directories here, skip if it's not our's */
 | 
							/* we're only creating directories here, skip if it's not our's */
 | 
				
			||||||
		if (lstat(path, &statbuf) == 0 && !S_ISDIR(statbuf.st_mode))
 | 
							if (lstat(path, &statbuf) == 0 && !S_ISDIR(statbuf.st_mode))
 | 
				
			||||||
@@ -1148,7 +1148,7 @@ RestoreSlotFromDisk(const char *name)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	ReplicationSlotOnDisk cp;
 | 
						ReplicationSlotOnDisk cp;
 | 
				
			||||||
	int			i;
 | 
						int			i;
 | 
				
			||||||
	char		path[MAXPGPATH];
 | 
						char		path[MAXPGPATH + 22];
 | 
				
			||||||
	int			fd;
 | 
						int			fd;
 | 
				
			||||||
	bool		restored = false;
 | 
						bool		restored = false;
 | 
				
			||||||
	int			readBytes;
 | 
						int			readBytes;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,8 +38,8 @@ copydir(char *fromdir, char *todir, bool recurse)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	DIR		   *xldir;
 | 
						DIR		   *xldir;
 | 
				
			||||||
	struct dirent *xlde;
 | 
						struct dirent *xlde;
 | 
				
			||||||
	char		fromfile[MAXPGPATH];
 | 
						char		fromfile[MAXPGPATH * 2];
 | 
				
			||||||
	char		tofile[MAXPGPATH];
 | 
						char		tofile[MAXPGPATH * 2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (mkdir(todir, S_IRWXU) != 0)
 | 
						if (mkdir(todir, S_IRWXU) != 0)
 | 
				
			||||||
		ereport(ERROR,
 | 
							ereport(ERROR,
 | 
				
			||||||
@@ -63,8 +63,8 @@ copydir(char *fromdir, char *todir, bool recurse)
 | 
				
			|||||||
			strcmp(xlde->d_name, "..") == 0)
 | 
								strcmp(xlde->d_name, "..") == 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		snprintf(fromfile, MAXPGPATH, "%s/%s", fromdir, xlde->d_name);
 | 
							snprintf(fromfile, sizeof(fromfile), "%s/%s", fromdir, xlde->d_name);
 | 
				
			||||||
		snprintf(tofile, MAXPGPATH, "%s/%s", todir, xlde->d_name);
 | 
							snprintf(tofile, sizeof(tofile), "%s/%s", todir, xlde->d_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (lstat(fromfile, &fst) < 0)
 | 
							if (lstat(fromfile, &fst) < 0)
 | 
				
			||||||
			ereport(ERROR,
 | 
								ereport(ERROR,
 | 
				
			||||||
@@ -103,7 +103,7 @@ copydir(char *fromdir, char *todir, bool recurse)
 | 
				
			|||||||
			strcmp(xlde->d_name, "..") == 0)
 | 
								strcmp(xlde->d_name, "..") == 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		snprintf(tofile, MAXPGPATH, "%s/%s", todir, xlde->d_name);
 | 
							snprintf(tofile, sizeof(tofile), "%s/%s", todir, xlde->d_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
		 * We don't need to sync subdirectories here since the recursive
 | 
							 * We don't need to sync subdirectories here since the recursive
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2654,7 +2654,7 @@ CleanupTempFiles(bool isProcExit)
 | 
				
			|||||||
void
 | 
					void
 | 
				
			||||||
RemovePgTempFiles(void)
 | 
					RemovePgTempFiles(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char		temp_path[MAXPGPATH];
 | 
						char		temp_path[MAXPGPATH + 10 + sizeof(TABLESPACE_VERSION_DIRECTORY) + sizeof(PG_TEMP_FILES_DIR)];
 | 
				
			||||||
	DIR		   *spc_dir;
 | 
						DIR		   *spc_dir;
 | 
				
			||||||
	struct dirent *spc_de;
 | 
						struct dirent *spc_de;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2702,7 +2702,7 @@ RemovePgTempFilesInDir(const char *tmpdirname)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	DIR		   *temp_dir;
 | 
						DIR		   *temp_dir;
 | 
				
			||||||
	struct dirent *temp_de;
 | 
						struct dirent *temp_de;
 | 
				
			||||||
	char		rm_path[MAXPGPATH];
 | 
						char		rm_path[MAXPGPATH * 2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	temp_dir = AllocateDir(tmpdirname);
 | 
						temp_dir = AllocateDir(tmpdirname);
 | 
				
			||||||
	if (temp_dir == NULL)
 | 
						if (temp_dir == NULL)
 | 
				
			||||||
@@ -2743,7 +2743,7 @@ RemovePgTempRelationFiles(const char *tsdirname)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	DIR		   *ts_dir;
 | 
						DIR		   *ts_dir;
 | 
				
			||||||
	struct dirent *de;
 | 
						struct dirent *de;
 | 
				
			||||||
	char		dbspace_path[MAXPGPATH];
 | 
						char		dbspace_path[MAXPGPATH * 2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ts_dir = AllocateDir(tsdirname);
 | 
						ts_dir = AllocateDir(tsdirname);
 | 
				
			||||||
	if (ts_dir == NULL)
 | 
						if (ts_dir == NULL)
 | 
				
			||||||
@@ -2784,7 +2784,7 @@ RemovePgTempRelationFilesInDbspace(const char *dbspacedirname)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	DIR		   *dbspace_dir;
 | 
						DIR		   *dbspace_dir;
 | 
				
			||||||
	struct dirent *de;
 | 
						struct dirent *de;
 | 
				
			||||||
	char		rm_path[MAXPGPATH];
 | 
						char		rm_path[MAXPGPATH * 2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dbspace_dir = AllocateDir(dbspacedirname);
 | 
						dbspace_dir = AllocateDir(dbspacedirname);
 | 
				
			||||||
	if (dbspace_dir == NULL)
 | 
						if (dbspace_dir == NULL)
 | 
				
			||||||
@@ -2971,7 +2971,7 @@ walkdir(const char *path,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	while ((de = ReadDirExtended(dir, path, elevel)) != NULL)
 | 
						while ((de = ReadDirExtended(dir, path, elevel)) != NULL)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		char		subpath[MAXPGPATH];
 | 
							char		subpath[MAXPGPATH * 2];
 | 
				
			||||||
		struct stat fst;
 | 
							struct stat fst;
 | 
				
			||||||
		int			sret;
 | 
							int			sret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2981,7 +2981,7 @@ walkdir(const char *path,
 | 
				
			|||||||
			strcmp(de->d_name, "..") == 0)
 | 
								strcmp(de->d_name, "..") == 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		snprintf(subpath, MAXPGPATH, "%s/%s", path, de->d_name);
 | 
							snprintf(subpath, sizeof(subpath), "%s/%s", path, de->d_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (process_symlinks)
 | 
							if (process_symlinks)
 | 
				
			||||||
			sret = stat(subpath, &fst);
 | 
								sret = stat(subpath, &fst);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -48,7 +48,7 @@ typedef struct
 | 
				
			|||||||
void
 | 
					void
 | 
				
			||||||
ResetUnloggedRelations(int op)
 | 
					ResetUnloggedRelations(int op)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char		temp_path[MAXPGPATH];
 | 
						char		temp_path[MAXPGPATH + 10 + sizeof(TABLESPACE_VERSION_DIRECTORY)];
 | 
				
			||||||
	DIR		   *spc_dir;
 | 
						DIR		   *spc_dir;
 | 
				
			||||||
	struct dirent *spc_de;
 | 
						struct dirent *spc_de;
 | 
				
			||||||
	MemoryContext tmpctx,
 | 
						MemoryContext tmpctx,
 | 
				
			||||||
@@ -104,7 +104,7 @@ ResetUnloggedRelationsInTablespaceDir(const char *tsdirname, int op)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	DIR		   *ts_dir;
 | 
						DIR		   *ts_dir;
 | 
				
			||||||
	struct dirent *de;
 | 
						struct dirent *de;
 | 
				
			||||||
	char		dbspace_path[MAXPGPATH];
 | 
						char		dbspace_path[MAXPGPATH * 2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ts_dir = AllocateDir(tsdirname);
 | 
						ts_dir = AllocateDir(tsdirname);
 | 
				
			||||||
	if (ts_dir == NULL)
 | 
						if (ts_dir == NULL)
 | 
				
			||||||
@@ -145,7 +145,7 @@ ResetUnloggedRelationsInDbspaceDir(const char *dbspacedirname, int op)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	DIR		   *dbspace_dir;
 | 
						DIR		   *dbspace_dir;
 | 
				
			||||||
	struct dirent *de;
 | 
						struct dirent *de;
 | 
				
			||||||
	char		rm_path[MAXPGPATH];
 | 
						char		rm_path[MAXPGPATH * 2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Caller must specify at least one operation. */
 | 
						/* Caller must specify at least one operation. */
 | 
				
			||||||
	Assert((op & (UNLOGGED_RELATION_CLEANUP | UNLOGGED_RELATION_INIT)) != 0);
 | 
						Assert((op & (UNLOGGED_RELATION_CLEANUP | UNLOGGED_RELATION_INIT)) != 0);
 | 
				
			||||||
@@ -308,7 +308,7 @@ ResetUnloggedRelationsInDbspaceDir(const char *dbspacedirname, int op)
 | 
				
			|||||||
			ForkNumber	forkNum;
 | 
								ForkNumber	forkNum;
 | 
				
			||||||
			int			oidchars;
 | 
								int			oidchars;
 | 
				
			||||||
			char		oidbuf[OIDCHARS + 1];
 | 
								char		oidbuf[OIDCHARS + 1];
 | 
				
			||||||
			char		srcpath[MAXPGPATH];
 | 
								char		srcpath[MAXPGPATH * 2];
 | 
				
			||||||
			char		dstpath[MAXPGPATH];
 | 
								char		dstpath[MAXPGPATH];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* Skip anything that doesn't look like a relation data file. */
 | 
								/* Skip anything that doesn't look like a relation data file. */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -306,9 +306,9 @@ dsm_cleanup_for_mmap(void)
 | 
				
			|||||||
		if (strncmp(dent->d_name, PG_DYNSHMEM_MMAP_FILE_PREFIX,
 | 
							if (strncmp(dent->d_name, PG_DYNSHMEM_MMAP_FILE_PREFIX,
 | 
				
			||||||
					strlen(PG_DYNSHMEM_MMAP_FILE_PREFIX)) == 0)
 | 
										strlen(PG_DYNSHMEM_MMAP_FILE_PREFIX)) == 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			char		buf[MAXPGPATH];
 | 
								char		buf[MAXPGPATH + sizeof(PG_DYNSHMEM_DIR)];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			snprintf(buf, MAXPGPATH, PG_DYNSHMEM_DIR "/%s", dent->d_name);
 | 
								snprintf(buf, sizeof(buf), PG_DYNSHMEM_DIR "/%s", dent->d_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			elog(DEBUG2, "removing file \"%s\"", buf);
 | 
								elog(DEBUG2, "removing file \"%s\"", buf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,7 +41,7 @@ db_dir_size(const char *path)
 | 
				
			|||||||
	int64		dirsize = 0;
 | 
						int64		dirsize = 0;
 | 
				
			||||||
	struct dirent *direntry;
 | 
						struct dirent *direntry;
 | 
				
			||||||
	DIR		   *dirdesc;
 | 
						DIR		   *dirdesc;
 | 
				
			||||||
	char		filename[MAXPGPATH];
 | 
						char		filename[MAXPGPATH * 2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dirdesc = AllocateDir(path);
 | 
						dirdesc = AllocateDir(path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -58,7 +58,7 @@ db_dir_size(const char *path)
 | 
				
			|||||||
			strcmp(direntry->d_name, "..") == 0)
 | 
								strcmp(direntry->d_name, "..") == 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		snprintf(filename, MAXPGPATH, "%s/%s", path, direntry->d_name);
 | 
							snprintf(filename, sizeof(filename), "%s/%s", path, direntry->d_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (stat(filename, &fst) < 0)
 | 
							if (stat(filename, &fst) < 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -86,7 +86,7 @@ calculate_database_size(Oid dbOid)
 | 
				
			|||||||
	DIR		   *dirdesc;
 | 
						DIR		   *dirdesc;
 | 
				
			||||||
	struct dirent *direntry;
 | 
						struct dirent *direntry;
 | 
				
			||||||
	char		dirpath[MAXPGPATH];
 | 
						char		dirpath[MAXPGPATH];
 | 
				
			||||||
	char		pathname[MAXPGPATH];
 | 
						char		pathname[MAXPGPATH + 12 + sizeof(TABLESPACE_VERSION_DIRECTORY)];
 | 
				
			||||||
	AclResult	aclresult;
 | 
						AclResult	aclresult;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* User must have connect privilege for target database */
 | 
						/* User must have connect privilege for target database */
 | 
				
			||||||
@@ -98,7 +98,7 @@ calculate_database_size(Oid dbOid)
 | 
				
			|||||||
	/* Shared storage in pg_global is not counted */
 | 
						/* Shared storage in pg_global is not counted */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Include pg_default storage */
 | 
						/* Include pg_default storage */
 | 
				
			||||||
	snprintf(pathname, MAXPGPATH, "base/%u", dbOid);
 | 
						snprintf(pathname, sizeof(pathname), "base/%u", dbOid);
 | 
				
			||||||
	totalsize = db_dir_size(pathname);
 | 
						totalsize = db_dir_size(pathname);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Scan the non-default tablespaces */
 | 
						/* Scan the non-default tablespaces */
 | 
				
			||||||
@@ -118,7 +118,7 @@ calculate_database_size(Oid dbOid)
 | 
				
			|||||||
			strcmp(direntry->d_name, "..") == 0)
 | 
								strcmp(direntry->d_name, "..") == 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		snprintf(pathname, MAXPGPATH, "pg_tblspc/%s/%s/%u",
 | 
							snprintf(pathname, sizeof(pathname), "pg_tblspc/%s/%s/%u",
 | 
				
			||||||
				 direntry->d_name, TABLESPACE_VERSION_DIRECTORY, dbOid);
 | 
									 direntry->d_name, TABLESPACE_VERSION_DIRECTORY, dbOid);
 | 
				
			||||||
		totalsize += db_dir_size(pathname);
 | 
							totalsize += db_dir_size(pathname);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -166,7 +166,7 @@ static int64
 | 
				
			|||||||
calculate_tablespace_size(Oid tblspcOid)
 | 
					calculate_tablespace_size(Oid tblspcOid)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char		tblspcPath[MAXPGPATH];
 | 
						char		tblspcPath[MAXPGPATH];
 | 
				
			||||||
	char		pathname[MAXPGPATH];
 | 
						char		pathname[MAXPGPATH * 2];
 | 
				
			||||||
	int64		totalsize = 0;
 | 
						int64		totalsize = 0;
 | 
				
			||||||
	DIR		   *dirdesc;
 | 
						DIR		   *dirdesc;
 | 
				
			||||||
	struct dirent *direntry;
 | 
						struct dirent *direntry;
 | 
				
			||||||
@@ -208,7 +208,7 @@ calculate_tablespace_size(Oid tblspcOid)
 | 
				
			|||||||
			strcmp(direntry->d_name, "..") == 0)
 | 
								strcmp(direntry->d_name, "..") == 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		snprintf(pathname, MAXPGPATH, "%s/%s", tblspcPath, direntry->d_name);
 | 
							snprintf(pathname, sizeof(pathname), "%s/%s", tblspcPath, direntry->d_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (stat(pathname, &fst) < 0)
 | 
							if (stat(pathname, &fst) < 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								src/backend/utils/cache/relcache.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								src/backend/utils/cache/relcache.c
									
									
									
									
										vendored
									
									
								
							@@ -5525,7 +5525,7 @@ RelationCacheInitFileRemove(void)
 | 
				
			|||||||
	const char *tblspcdir = "pg_tblspc";
 | 
						const char *tblspcdir = "pg_tblspc";
 | 
				
			||||||
	DIR		   *dir;
 | 
						DIR		   *dir;
 | 
				
			||||||
	struct dirent *de;
 | 
						struct dirent *de;
 | 
				
			||||||
	char		path[MAXPGPATH];
 | 
						char		path[MAXPGPATH + 10 + sizeof(TABLESPACE_VERSION_DIRECTORY)];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * We zap the shared cache file too.  In theory it can't get out of sync
 | 
						 * We zap the shared cache file too.  In theory it can't get out of sync
 | 
				
			||||||
@@ -5567,7 +5567,7 @@ RelationCacheInitFileRemoveInDir(const char *tblspcpath)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	DIR		   *dir;
 | 
						DIR		   *dir;
 | 
				
			||||||
	struct dirent *de;
 | 
						struct dirent *de;
 | 
				
			||||||
	char		initfilename[MAXPGPATH];
 | 
						char		initfilename[MAXPGPATH * 2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Scan the tablespace directory to find per-database directories */
 | 
						/* Scan the tablespace directory to find per-database directories */
 | 
				
			||||||
	dir = AllocateDir(tblspcpath);
 | 
						dir = AllocateDir(tblspcpath);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2228,7 +2228,7 @@ static void
 | 
				
			|||||||
setup_formatted_log_time(void)
 | 
					setup_formatted_log_time(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	pg_time_t	stamp_time;
 | 
						pg_time_t	stamp_time;
 | 
				
			||||||
	char		msbuf[8];
 | 
						char		msbuf[13];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!saved_timeval_set)
 | 
						if (!saved_timeval_set)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1569,7 +1569,7 @@ XactHasExportedSnapshots(void)
 | 
				
			|||||||
void
 | 
					void
 | 
				
			||||||
DeleteAllExportedSnapshotFiles(void)
 | 
					DeleteAllExportedSnapshotFiles(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char		buf[MAXPGPATH];
 | 
						char		buf[MAXPGPATH + sizeof(SNAPSHOT_EXPORT_DIR)];
 | 
				
			||||||
	DIR		   *s_dir;
 | 
						DIR		   *s_dir;
 | 
				
			||||||
	struct dirent *s_de;
 | 
						struct dirent *s_de;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1590,7 +1590,7 @@ DeleteAllExportedSnapshotFiles(void)
 | 
				
			|||||||
			strcmp(s_de->d_name, "..") == 0)
 | 
								strcmp(s_de->d_name, "..") == 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		snprintf(buf, MAXPGPATH, SNAPSHOT_EXPORT_DIR "/%s", s_de->d_name);
 | 
							snprintf(buf, sizeof(buf), SNAPSHOT_EXPORT_DIR "/%s", s_de->d_name);
 | 
				
			||||||
		/* Again, unlink failure is not worthy of FATAL */
 | 
							/* Again, unlink failure is not worthy of FATAL */
 | 
				
			||||||
		if (unlink(buf))
 | 
							if (unlink(buf))
 | 
				
			||||||
			elog(LOG, "could not unlink file \"%s\": %m", buf);
 | 
								elog(LOG, "could not unlink file \"%s\": %m", buf);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -567,7 +567,7 @@ walkdir(const char *path,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	while (errno = 0, (de = readdir(dir)) != NULL)
 | 
						while (errno = 0, (de = readdir(dir)) != NULL)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		char		subpath[MAXPGPATH];
 | 
							char		subpath[MAXPGPATH * 2];
 | 
				
			||||||
		struct stat fst;
 | 
							struct stat fst;
 | 
				
			||||||
		int			sret;
 | 
							int			sret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -575,7 +575,7 @@ walkdir(const char *path,
 | 
				
			|||||||
			strcmp(de->d_name, "..") == 0)
 | 
								strcmp(de->d_name, "..") == 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		snprintf(subpath, MAXPGPATH, "%s/%s", path, de->d_name);
 | 
							snprintf(subpath, sizeof(subpath), "%s/%s", path, de->d_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (process_symlinks)
 | 
							if (process_symlinks)
 | 
				
			||||||
			sret = stat(subpath, &fst);
 | 
								sret = stat(subpath, &fst);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,7 @@ char	   *additional_ext = NULL;		/* Extension to remove from filenames */
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
char	   *archiveLocation;	/* where to find the archive? */
 | 
					char	   *archiveLocation;	/* where to find the archive? */
 | 
				
			||||||
char	   *restartWALFileName; /* the file from which we can restart restore */
 | 
					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[MAXFNAMELEN];		/* the oldest file we
 | 
					char		exclusiveCleanupFileName[MAXFNAMELEN];		/* the oldest file we
 | 
				
			||||||
														 * want to remain in
 | 
																			 * want to remain in
 | 
				
			||||||
														 * archive */
 | 
																			 * archive */
 | 
				
			||||||
@@ -133,7 +133,7 @@ CleanupPriorWALFiles(void)
 | 
				
			|||||||
				 * extension that might have been chopped off before testing
 | 
									 * extension that might have been chopped off before testing
 | 
				
			||||||
				 * the sequence.
 | 
									 * the sequence.
 | 
				
			||||||
				 */
 | 
									 */
 | 
				
			||||||
				snprintf(WALFilePath, MAXPGPATH, "%s/%s",
 | 
									snprintf(WALFilePath, sizeof(WALFilePath), "%s/%s",
 | 
				
			||||||
						 archiveLocation, xlde->d_name);
 | 
											 archiveLocation, xlde->d_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (dryrun)
 | 
									if (dryrun)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -210,7 +210,7 @@ FindStreamingStart(uint32 *tli)
 | 
				
			|||||||
		if (!ispartial)
 | 
							if (!ispartial)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			struct stat statbuf;
 | 
								struct stat statbuf;
 | 
				
			||||||
			char		fullpath[MAXPGPATH];
 | 
								char		fullpath[MAXPGPATH * 2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			snprintf(fullpath, sizeof(fullpath), "%s/%s", basedir, dirent->d_name);
 | 
								snprintf(fullpath, sizeof(fullpath), "%s/%s", basedir, dirent->d_name);
 | 
				
			||||||
			if (stat(fullpath, &statbuf) != 0)
 | 
								if (stat(fullpath, &statbuf) != 0)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -963,7 +963,7 @@ KillExistingXLOG(void)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	DIR		   *xldir;
 | 
						DIR		   *xldir;
 | 
				
			||||||
	struct dirent *xlde;
 | 
						struct dirent *xlde;
 | 
				
			||||||
	char		path[MAXPGPATH];
 | 
						char		path[MAXPGPATH + sizeof(XLOGDIR)];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	xldir = opendir(XLOGDIR);
 | 
						xldir = opendir(XLOGDIR);
 | 
				
			||||||
	if (xldir == NULL)
 | 
						if (xldir == NULL)
 | 
				
			||||||
@@ -978,7 +978,7 @@ KillExistingXLOG(void)
 | 
				
			|||||||
		if (IsXLogFileName(xlde->d_name) ||
 | 
							if (IsXLogFileName(xlde->d_name) ||
 | 
				
			||||||
			IsPartialXLogFileName(xlde->d_name))
 | 
								IsPartialXLogFileName(xlde->d_name))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			snprintf(path, MAXPGPATH, "%s/%s", XLOGDIR, xlde->d_name);
 | 
								snprintf(path, sizeof(path), "%s/%s", XLOGDIR, xlde->d_name);
 | 
				
			||||||
			if (unlink(path) < 0)
 | 
								if (unlink(path) < 0)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				fprintf(stderr, _("%s: could not delete file \"%s\": %s\n"),
 | 
									fprintf(stderr, _("%s: could not delete file \"%s\": %s\n"),
 | 
				
			||||||
@@ -1010,11 +1010,11 @@ KillExistingXLOG(void)
 | 
				
			|||||||
static void
 | 
					static void
 | 
				
			||||||
KillExistingArchiveStatus(void)
 | 
					KillExistingArchiveStatus(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					#define ARCHSTATDIR XLOGDIR "/archive_status"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	DIR		   *xldir;
 | 
						DIR		   *xldir;
 | 
				
			||||||
	struct dirent *xlde;
 | 
						struct dirent *xlde;
 | 
				
			||||||
	char		path[MAXPGPATH];
 | 
						char		path[MAXPGPATH + sizeof(ARCHSTATDIR)];
 | 
				
			||||||
 | 
					 | 
				
			||||||
#define ARCHSTATDIR XLOGDIR "/archive_status"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	xldir = opendir(ARCHSTATDIR);
 | 
						xldir = opendir(ARCHSTATDIR);
 | 
				
			||||||
	if (xldir == NULL)
 | 
						if (xldir == NULL)
 | 
				
			||||||
@@ -1032,7 +1032,7 @@ KillExistingArchiveStatus(void)
 | 
				
			|||||||
			 strcmp(xlde->d_name + XLOG_FNAME_LEN, ".partial.ready") == 0 ||
 | 
								 strcmp(xlde->d_name + XLOG_FNAME_LEN, ".partial.ready") == 0 ||
 | 
				
			||||||
			 strcmp(xlde->d_name + XLOG_FNAME_LEN, ".partial.done") == 0))
 | 
								 strcmp(xlde->d_name + XLOG_FNAME_LEN, ".partial.done") == 0))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			snprintf(path, MAXPGPATH, "%s/%s", ARCHSTATDIR, xlde->d_name);
 | 
								snprintf(path, sizeof(path), "%s/%s", ARCHSTATDIR, xlde->d_name);
 | 
				
			||||||
			if (unlink(path) < 0)
 | 
								if (unlink(path) < 0)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				fprintf(stderr, _("%s: could not delete file \"%s\": %s\n"),
 | 
									fprintf(stderr, _("%s: could not delete file \"%s\": %s\n"),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -67,14 +67,14 @@ recurse_dir(const char *datadir, const char *parentpath,
 | 
				
			|||||||
	while (errno = 0, (xlde = readdir(xldir)) != NULL)
 | 
						while (errno = 0, (xlde = readdir(xldir)) != NULL)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		struct stat fst;
 | 
							struct stat fst;
 | 
				
			||||||
		char		fullpath[MAXPGPATH];
 | 
							char		fullpath[MAXPGPATH * 2];
 | 
				
			||||||
		char		path[MAXPGPATH];
 | 
							char		path[MAXPGPATH * 2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (strcmp(xlde->d_name, ".") == 0 ||
 | 
							if (strcmp(xlde->d_name, ".") == 0 ||
 | 
				
			||||||
			strcmp(xlde->d_name, "..") == 0)
 | 
								strcmp(xlde->d_name, "..") == 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		snprintf(fullpath, MAXPGPATH, "%s/%s", fullparentpath, xlde->d_name);
 | 
							snprintf(fullpath, sizeof(fullpath), "%s/%s", fullparentpath, xlde->d_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (lstat(fullpath, &fst) < 0)
 | 
							if (lstat(fullpath, &fst) < 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -95,9 +95,9 @@ recurse_dir(const char *datadir, const char *parentpath,
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (parentpath)
 | 
							if (parentpath)
 | 
				
			||||||
			snprintf(path, MAXPGPATH, "%s/%s", parentpath, xlde->d_name);
 | 
								snprintf(path, sizeof(path), "%s/%s", parentpath, xlde->d_name);
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			snprintf(path, MAXPGPATH, "%s", xlde->d_name);
 | 
								snprintf(path, sizeof(path), "%s", xlde->d_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (S_ISREG(fst.st_mode))
 | 
							if (S_ISREG(fst.st_mode))
 | 
				
			||||||
			callback(path, FILE_TYPE_REGULAR, fst.st_size, NULL);
 | 
								callback(path, FILE_TYPE_REGULAR, fst.st_size, NULL);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -437,7 +437,7 @@ pg_tzenumerate_next(pg_tzenum *dir)
 | 
				
			|||||||
	while (dir->depth >= 0)
 | 
						while (dir->depth >= 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		struct dirent *direntry;
 | 
							struct dirent *direntry;
 | 
				
			||||||
		char		fullname[MAXPGPATH];
 | 
							char		fullname[MAXPGPATH * 2];
 | 
				
			||||||
		struct stat statbuf;
 | 
							struct stat statbuf;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		direntry = ReadDir(dir->dirdesc[dir->depth], dir->dirname[dir->depth]);
 | 
							direntry = ReadDir(dir->dirdesc[dir->depth], dir->dirname[dir->depth]);
 | 
				
			||||||
@@ -454,7 +454,7 @@ pg_tzenumerate_next(pg_tzenum *dir)
 | 
				
			|||||||
		if (direntry->d_name[0] == '.')
 | 
							if (direntry->d_name[0] == '.')
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		snprintf(fullname, MAXPGPATH, "%s/%s",
 | 
							snprintf(fullname, sizeof(fullname), "%s/%s",
 | 
				
			||||||
				 dir->dirname[dir->depth], direntry->d_name);
 | 
									 dir->dirname[dir->depth], direntry->d_name);
 | 
				
			||||||
		if (stat(fullname, &statbuf) != 0)
 | 
							if (stat(fullname, &statbuf) != 0)
 | 
				
			||||||
			ereport(ERROR,
 | 
								ereport(ERROR,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user