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

Commitb1065f8

Browse files
committed
Fix checking of file operations in demo ('files') output format.
1 parenta062473 commitb1065f8

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

‎src/bin/pg_dump/pg_backup_files.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
*
2222
* IDENTIFICATION
23-
*$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.8 2001/03/22 04:00:13 momjian Exp $
23+
*$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.9 2001/03/23 01:27:12 pjw Exp $
2424
*
2525
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
2626
*
@@ -158,7 +158,9 @@ InitArchiveFmt_Files(ArchiveHandle *AH)
158158

159159
ReadHead(AH);
160160
ReadToc(AH);
161-
fclose(AH->FH);/* Nothing else in the file... */
161+
/* Nothing else in the file... */
162+
if (fclose(AH->FH)!=0)
163+
die_horribly(AH,"%s: Could not close TOC file (fclose failed).\n",progname);
162164
}
163165

164166
}
@@ -268,7 +270,9 @@ _EndData(ArchiveHandle *AH, TocEntry *te)
268270
lclTocEntry*tctx= (lclTocEntry*)te->formatData;
269271

270272
/* Close the file */
271-
GZCLOSE(tctx->FH);
273+
if (GZCLOSE(tctx->FH)!=0)
274+
die_horribly(AH,"%s: could not close data file\n",progname);
275+
272276
tctx->FH=NULL;
273277
}
274278

@@ -299,7 +303,9 @@ _PrintFileData(ArchiveHandle *AH, char *filename, RestoreOptions *ropt)
299303
ahwrite(buf,1,cnt,AH);
300304
}
301305

302-
GZCLOSE(AH->FH);
306+
if (GZCLOSE(AH->FH)!=0)
307+
die_horribly(AH,"%s: could not close data file after reading\n",progname);
308+
303309
}
304310

305311

@@ -374,7 +380,8 @@ _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt)
374380
_getBlobTocEntry(AH,&oid,fname);
375381
}
376382

377-
fclose(ctx->blobToc);
383+
if (fclose(ctx->blobToc)!=0)
384+
die_horribly(AH,"%s: could not close BLOB TOC file\n",progname);
378385

379386
EndRestoreBlobs(AH);
380387
}
@@ -437,7 +444,8 @@ _CloseArchive(ArchiveHandle *AH)
437444
{
438445
WriteHead(AH);
439446
WriteToc(AH);
440-
fclose(AH->FH);
447+
if (fclose(AH->FH)!=0)
448+
die_horribly(AH,"%s: could not close TOC file\n",progname);
441449
WriteDataChunks(AH);
442450
}
443451

@@ -524,7 +532,8 @@ _EndBlob(ArchiveHandle *AH, TocEntry *te, int oid)
524532
{
525533
lclTocEntry*tctx= (lclTocEntry*)te->formatData;
526534

527-
GZCLOSE(tctx->FH);
535+
if (GZCLOSE(tctx->FH)!=0)
536+
die_horribly(AH,"%s: could not close BLOB file\n",progname);
528537
}
529538

530539
/*
@@ -541,6 +550,8 @@ _EndBlobs(ArchiveHandle *AH, TocEntry *te)
541550
/* Write out a fake zero OID to mark end-of-blobs. */
542551
/* WriteInt(AH, 0); */
543552

544-
fclose(ctx->blobToc);
553+
if (fclose(ctx->blobToc)!=0)
554+
die_horribly(AH,"%s: could not close BLOB TOC file\n",progname);
545555

546556
}
557+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp