aboutsummaryrefslogtreecommitdiff
path: root/contrib/pg_resetxlog/pg_resetxlog.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/pg_resetxlog/pg_resetxlog.c')
-rw-r--r--contrib/pg_resetxlog/pg_resetxlog.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/contrib/pg_resetxlog/pg_resetxlog.c b/contrib/pg_resetxlog/pg_resetxlog.c
index 90fd3136dd8..f8c81b5c55d 100644
--- a/contrib/pg_resetxlog/pg_resetxlog.c
+++ b/contrib/pg_resetxlog/pg_resetxlog.c
@@ -23,7 +23,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Header: /cvsroot/pgsql/contrib/pg_resetxlog/Attic/pg_resetxlog.c,v 1.4 2001/05/30 14:18:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/contrib/pg_resetxlog/Attic/pg_resetxlog.c,v 1.5 2001/06/06 17:07:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -772,8 +772,12 @@ RewriteControlFile(void)
exit(1);
}
+ errno = 0;
if (write(fd, buffer, BLCKSZ) != BLCKSZ)
{
+ /* if write didn't set errno, assume problem is no disk space */
+ if (errno == 0)
+ errno = ENOSPC;
perror("RewriteControlFile failed to write pg_control file");
exit(1);
}
@@ -884,8 +888,12 @@ WriteEmptyXLOG(void)
exit(1);
}
+ errno = 0;
if (write(fd, buffer, BLCKSZ) != BLCKSZ)
{
+ /* if write didn't set errno, assume problem is no disk space */
+ if (errno == 0)
+ errno = ENOSPC;
perror("WriteEmptyXLOG: failed to write xlog file");
exit(1);
}
@@ -894,8 +902,11 @@ WriteEmptyXLOG(void)
memset(buffer, 0, BLCKSZ);
for (nbytes = BLCKSZ; nbytes < XLogSegSize; nbytes += BLCKSZ)
{
+ errno = 0;
if (write(fd, buffer, BLCKSZ) != BLCKSZ)
{
+ if (errno == 0)
+ errno = ENOSPC;
perror("WriteEmptyXLOG: failed to write xlog file");
exit(1);
}