Skip to content

Commit 2cd6520

Browse files
committed
Fix compiler warning about format truncation
1 parent f1464c5 commit 2cd6520

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/bin/pg_verify_checksums/pg_verify_checksums.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ scan_directory(char *basedir, char *subdir)
130130
DIR *dir;
131131
struct dirent *de;
132132

133-
snprintf(path, MAXPGPATH, "%s/%s", basedir, subdir);
133+
snprintf(path, sizeof(path), "%s/%s", basedir, subdir);
134134
dir = opendir(path);
135135
if (!dir)
136136
{
@@ -140,13 +140,13 @@ scan_directory(char *basedir, char *subdir)
140140
}
141141
while ((de = readdir(dir)) != NULL)
142142
{
143-
char fn[MAXPGPATH];
143+
char fn[MAXPGPATH + 1];
144144
struct stat st;
145145

146146
if (skipfile(de->d_name))
147147
continue;
148148

149-
snprintf(fn, MAXPGPATH, "%s/%s", path, de->d_name);
149+
snprintf(fn, sizeof(fn), "%s/%s", path, de->d_name);
150150
if (lstat(fn, &st) < 0)
151151
{
152152
fprintf(stderr, _("%s: could not stat file \"%s\": %m\n"),

0 commit comments

Comments
 (0)