|
7 | 7 | * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group |
8 | 8 | * Portions Copyright (c) 1994, Regents of the University of California |
9 | 9 | * |
10 | | - * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.132 2004/01/19 19:04:40 tgl Exp $ |
| 10 | + * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.133 2004/01/26 22:35:31 tgl Exp $ |
11 | 11 | * |
12 | 12 | *------------------------------------------------------------------------- |
13 | 13 | */ |
@@ -1044,7 +1044,7 @@ XLogWrite(XLogwrtRqst WriteRqst) |
1044 | 1044 | */ |
1045 | 1045 | if (openLogFile >=0) |
1046 | 1046 | { |
1047 | | -if (close(openLogFile)!=0) |
| 1047 | +if (close(openLogFile)) |
1048 | 1048 | ereport(PANIC, |
1049 | 1049 | (errcode_for_file_access(), |
1050 | 1050 | errmsg("could not close log file %u, segment %u: %m", |
@@ -1162,7 +1162,7 @@ XLogWrite(XLogwrtRqst WriteRqst) |
1162 | 1162 | if (openLogFile >=0&& |
1163 | 1163 | !XLByteInPrevSeg(LogwrtResult.Write,openLogId,openLogSeg)) |
1164 | 1164 | { |
1165 | | -if (close(openLogFile)!=0) |
| 1165 | +if (close(openLogFile)) |
1166 | 1166 | ereport(PANIC, |
1167 | 1167 | (errcode_for_file_access(), |
1168 | 1168 | errmsg("could not close log file %u, segment %u: %m", |
@@ -1427,7 +1427,10 @@ XLogFileInit(uint32 log, uint32 seg, |
1427 | 1427 | (errcode_for_file_access(), |
1428 | 1428 | errmsg("could not fsync file \"%s\": %m",tmppath))); |
1429 | 1429 |
|
1430 | | -close(fd); |
| 1430 | +if (close(fd)) |
| 1431 | +ereport(PANIC, |
| 1432 | +(errcode_for_file_access(), |
| 1433 | +errmsg("could not close file \"%s\": %m",tmppath))); |
1431 | 1434 |
|
1432 | 1435 | /* |
1433 | 1436 | * Now move the segment into place with its final name. |
@@ -2205,7 +2208,10 @@ WriteControlFile(void) |
2205 | 2208 | (errcode_for_file_access(), |
2206 | 2209 | errmsg("could not fsync control file: %m"))); |
2207 | 2210 |
|
2208 | | -close(fd); |
| 2211 | +if (close(fd)) |
| 2212 | +ereport(PANIC, |
| 2213 | +(errcode_for_file_access(), |
| 2214 | +errmsg("could not close control file: %m"))); |
2209 | 2215 | } |
2210 | 2216 |
|
2211 | 2217 | staticvoid |
@@ -2382,7 +2388,10 @@ UpdateControlFile(void) |
2382 | 2388 | (errcode_for_file_access(), |
2383 | 2389 | errmsg("could not fsync control file: %m"))); |
2384 | 2390 |
|
2385 | | -close(fd); |
| 2391 | +if (close(fd)) |
| 2392 | +ereport(PANIC, |
| 2393 | +(errcode_for_file_access(), |
| 2394 | +errmsg("could not close control file: %m"))); |
2386 | 2395 | } |
2387 | 2396 |
|
2388 | 2397 | /* |
@@ -2535,7 +2544,11 @@ BootStrapXLOG(void) |
2535 | 2544 | (errcode_for_file_access(), |
2536 | 2545 | errmsg("could not fsync bootstrap transaction log file: %m"))); |
2537 | 2546 |
|
2538 | | -close(openLogFile); |
| 2547 | +if (close(openLogFile)) |
| 2548 | +ereport(PANIC, |
| 2549 | +(errcode_for_file_access(), |
| 2550 | +errmsg("could not close bootstrap transaction log file: %m"))); |
| 2551 | + |
2539 | 2552 | openLogFile=-1; |
2540 | 2553 |
|
2541 | 2554 | memset(ControlFile,0,sizeof(ControlFileData)); |
@@ -3577,7 +3590,7 @@ assign_xlog_sync_method(const char *method, bool doit, GucSource source) |
3577 | 3590 | openLogId,openLogSeg))); |
3578 | 3591 | if (open_sync_bit!=new_sync_bit) |
3579 | 3592 | { |
3580 | | -if (close(openLogFile)!=0) |
| 3593 | +if (close(openLogFile)) |
3581 | 3594 | ereport(PANIC, |
3582 | 3595 | (errcode_for_file_access(), |
3583 | 3596 | errmsg("could not close log file %u, segment %u: %m", |
|