Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitef1f158

Browse files
Fix bug in TOC file error message printing
If the blob TOC file cannot be parsed, the error message was failingto print the filename as the variable holding it was shadowed by thedestination buffer for parsing. When the filename fails to parse,the error will print an empty string: ./pg_restore -d foo -F d dump pg_restore: error: invalid line in large object TOC file "": ....instead of the intended error message: ./pg_restore -d foo -F d dump pg_restore: error: invalid line in large object TOC file "dump/blobs.toc": ..Fix by renaming both variables as the shared name was too generic tostore either and still convey what the variable held.Backpatch all the way down to 9.6.Reviewed-by: Tom LaneDiscussion:https://postgr.es/m/A2B151F5-B32B-4F2C-BA4A-6870856D9BDE@yesql.seBackpatch-through: 9.6
1 parent6b96aaf commitef1f158

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

‎src/bin/pg_dump/pg_backup_directory.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -447,42 +447,42 @@ _LoadBlobs(ArchiveHandle *AH)
447447
{
448448
Oidoid;
449449
lclContext*ctx= (lclContext*)AH->formatData;
450-
charfname[MAXPGPATH];
450+
chartocfname[MAXPGPATH];
451451
charline[MAXPGPATH];
452452

453453
StartRestoreBlobs(AH);
454454

455-
setFilePath(AH,fname,"blobs.toc");
455+
setFilePath(AH,tocfname,"blobs.toc");
456456

457-
ctx->blobsTocFH=cfopen_read(fname,PG_BINARY_R);
457+
ctx->blobsTocFH=cfopen_read(tocfname,PG_BINARY_R);
458458

459459
if (ctx->blobsTocFH==NULL)
460460
exit_horribly(modulename,"could not open large object TOC file \"%s\" for input: %s\n",
461-
fname,strerror(errno));
461+
tocfname,strerror(errno));
462462

463463
/* Read the blobs TOC file line-by-line, and process each blob */
464464
while ((cfgets(ctx->blobsTocFH,line,MAXPGPATH))!=NULL)
465465
{
466-
charfname[MAXPGPATH+1];
466+
charblobfname[MAXPGPATH+1];
467467
charpath[MAXPGPATH];
468468

469-
/* Can't overflow because line andfname are the same length. */
470-
if (sscanf(line,"%u %"CppAsString2(MAXPGPATH)"s\n",&oid,fname)!=2)
469+
/* Can't overflow because line andblobfname are the same length. */
470+
if (sscanf(line,"%u %"CppAsString2(MAXPGPATH)"s\n",&oid,blobfname)!=2)
471471
exit_horribly(modulename,"invalid line in large object TOC file \"%s\": \"%s\"\n",
472-
fname,line);
472+
tocfname,line);
473473

474474
StartRestoreBlob(AH,oid,AH->public.ropt->dropSchema);
475-
snprintf(path,MAXPGPATH,"%s/%s",ctx->directory,fname);
475+
snprintf(path,MAXPGPATH,"%s/%s",ctx->directory,blobfname);
476476
_PrintFileData(AH,path);
477477
EndRestoreBlob(AH,oid);
478478
}
479479
if (!cfeof(ctx->blobsTocFH))
480480
exit_horribly(modulename,"error reading large object TOC file \"%s\"\n",
481-
fname);
481+
tocfname);
482482

483483
if (cfclose(ctx->blobsTocFH)!=0)
484484
exit_horribly(modulename,"could not close large object TOC file \"%s\": %s\n",
485-
fname,strerror(errno));
485+
tocfname,strerror(errno));
486486

487487
ctx->blobsTocFH=NULL;
488488

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp