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

Commit998d060

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 parent1d7641d commit998d060

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
@@ -433,42 +433,42 @@ _LoadBlobs(ArchiveHandle *AH)
433433
{
434434
Oidoid;
435435
lclContext*ctx= (lclContext*)AH->formatData;
436-
charfname[MAXPGPATH];
436+
chartocfname[MAXPGPATH];
437437
charline[MAXPGPATH];
438438

439439
StartRestoreBlobs(AH);
440440

441-
setFilePath(AH,fname,"blobs.toc");
441+
setFilePath(AH,tocfname,"blobs.toc");
442442

443-
ctx->blobsTocFH=cfopen_read(fname,PG_BINARY_R);
443+
ctx->blobsTocFH=cfopen_read(tocfname,PG_BINARY_R);
444444

445445
if (ctx->blobsTocFH==NULL)
446446
fatal("could not open large object TOC file \"%s\" for input: %m",
447-
fname);
447+
tocfname);
448448

449449
/* Read the blobs TOC file line-by-line, and process each blob */
450450
while ((cfgets(ctx->blobsTocFH,line,MAXPGPATH))!=NULL)
451451
{
452-
charfname[MAXPGPATH+1];
452+
charblobfname[MAXPGPATH+1];
453453
charpath[MAXPGPATH];
454454

455-
/* Can't overflow because line andfname are the same length. */
456-
if (sscanf(line,"%u %"CppAsString2(MAXPGPATH)"s\n",&oid,fname)!=2)
455+
/* Can't overflow because line andblobfname are the same length */
456+
if (sscanf(line,"%u %"CppAsString2(MAXPGPATH)"s\n",&oid,blobfname)!=2)
457457
fatal("invalid line in large object TOC file \"%s\": \"%s\"",
458-
fname,line);
458+
tocfname,line);
459459

460460
StartRestoreBlob(AH,oid,AH->public.ropt->dropSchema);
461-
snprintf(path,MAXPGPATH,"%s/%s",ctx->directory,fname);
461+
snprintf(path,MAXPGPATH,"%s/%s",ctx->directory,blobfname);
462462
_PrintFileData(AH,path);
463463
EndRestoreBlob(AH,oid);
464464
}
465465
if (!cfeof(ctx->blobsTocFH))
466466
fatal("error reading large object TOC file \"%s\"",
467-
fname);
467+
tocfname);
468468

469469
if (cfclose(ctx->blobsTocFH)!=0)
470470
fatal("could not close large object TOC file \"%s\": %m",
471-
fname);
471+
tocfname);
472472

473473
ctx->blobsTocFH=NULL;
474474

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp