/*
* recursive part of traverse_datadir
*
- * parent_path is the current subdirectory's path relative to datadir,
+ * parentpath is the current subdirectory's path relative to datadir,
* or NULL at the top level.
*/
static void
copy_file_range(path, offset, offset + BLCKSZ, false);
/* Ok, this block has now been copied from new data dir to old */
}
- free(iter);
+ pg_free(iter);
}
* Start iterating through all entries in the page map.
*
* After datapagemap_iterate, call datapagemap_next to return the entries,
- * until it returns NULL. After you're done, use free() to destroy the
+ * until it returns false. After you're done, use pg_free() to destroy the
* iterator.
*/
datapagemap_iterator_t *
while (datapagemap_next(iter, &blocknum))
printf(" blk %u\n", blocknum);
- free(iter);
+ pg_free(iter);
}
{
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;
case FILE_TYPE_DIRECTORY:
if (exists && !S_ISDIR(statbuf.st_mode))
{
- /* it's a directory in target, but not in source. Strange.. */
+ /* it's a directory in source, but not in target. Strange.. */
pg_fatal("\"%s\" is not a directory\n", localpath);
}
)
{
/*
- * It's a symbolic link in target, but not in source.
+ * It's a symbolic link in source, but not in target.
* Strange..
*/
pg_fatal("\"%s\" is not a symbolic link\n", localpath);
entry = *e;
else
entry = NULL;
- free(path);
+ pfree(path);
if (entry)
{
* Does it look like a relation data file?
*
* For our purposes, only files belonging to the main fork are considered
- * relation files. Other forks are alwayes copied in toto, because we cannot
+ * relation files. Other forks are always copied in toto, because we cannot
* reliably track changes to them, because WAL only contains block references
* for the main fork.
*/
pg_free(str);
/*
- * Also check that full_page-writes are enabled. We can get torn pages if
+ * Also check that full_page_writes is enabled. We can get torn pages if
* a page is modified while we read it with pg_read_binary_file(), and we
* rely on full page images to fix them.
*/
fetch_file_range(path, offset, offset + BLCKSZ);
}
- free(iter);
+ pg_free(iter);
}
extern void progress_report(bool force);
-#endif
+#endif /* PG_REWIND_LOGGING_H */
}
}
- while ((c = getopt_long(argc, argv, "D:NnP", long_options, &option_index)) != -1)
+ while ((c = getopt_long(argc, argv, "D:nP", long_options, &option_index)) != -1)
{
switch (c)
{
if (ControlFile_target.data_checksum_version != PG_DATA_CHECKSUM_VERSION &&
!ControlFile_target.wal_log_hints)
{
- pg_fatal("target server need to use either data checksums or \"wal_log_hints = on\"\n");
+ pg_fatal("target server needs to use either data checksums or \"wal_log_hints = on\"\n");
}
/*
*recptr = entry->end;
*tli = entry->tli;
- free(sourceHistory);
+ pg_free(sourceHistory);
return;
}
}