diff options
author | Fujii Masao <fujii@postgresql.org> | 2015-06-11 22:31:18 +0900 |
---|---|---|
committer | Fujii Masao <fujii@postgresql.org> | 2015-06-11 22:31:18 +0900 |
commit | 966c37fdb5ed9b87f3e91eace4dbbed7909f6769 (patch) | |
tree | 65304d1c1ddc9b0aaeebf933e168221d2a1d77ae /src/bin/pg_rewind/file_ops.c | |
parent | aacb8b9277ec63ee848442ccc1aa4b3f6eab1893 (diff) |
Fix some issues in pg_rewind.
* Remove invalid option character "N" from the third argument (valid option
string) of getopt_long().
* Use pg_free() or pfree() to free the memory allocated by pg_malloc() or
palloc() instead of always using free().
* Assume problem is no disk space if write() fails but doesn't set errno.
* Fix several typos.
Patch by me. Review by Michael Paquier.
Diffstat (limited to 'src/bin/pg_rewind/file_ops.c')
-rw-r--r-- | src/bin/pg_rewind/file_ops.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bin/pg_rewind/file_ops.c b/src/bin/pg_rewind/file_ops.c index 589a01a4340..d6a743f7884 100644 --- a/src/bin/pg_rewind/file_ops.c +++ b/src/bin/pg_rewind/file_ops.c @@ -105,10 +105,16 @@ write_target_range(char *buf, off_t begin, size_t size) { int writelen; + errno = 0; writelen = write(dstfd, p, writeleft); if (writelen < 0) + { + /* if write didn't set errno, assume problem is no disk space */ + if (errno == 0) + errno = ENOSPC; pg_fatal("could not write file \"%s\": %s\n", dstpath, strerror(errno)); + } p += writelen; writeleft -= writelen; |