}
output_reopen = false;
+ /* open the output file, if not open yet */
+ if (outfd == -1)
+ {
+ if (strcmp(outfile, "-") == 0)
+ outfd = fileno(stdout);
+ else
+ outfd = open(outfile, O_CREAT | O_APPEND | O_WRONLY | PG_BINARY,
+ S_IRUSR | S_IWUSR);
+ if (outfd == -1)
+ {
+ fprintf(stderr,
+ _("%s: could not open log file \"%s\": %s\n"),
+ progname, outfile, strerror(errno));
+ goto error;
+ }
+ }
+
r = PQgetCopyData(conn, ©buf, 1);
if (r == 0)
{
output_written_lsn = Max(temp, output_written_lsn);
}
- /* open the output file, if not open yet */
- if (outfd == -1)
- {
- if (strcmp(outfile, "-") == 0)
- outfd = fileno(stdout);
- else
- outfd = open(outfile, O_CREAT | O_APPEND | O_WRONLY | PG_BINARY,
- S_IRUSR | S_IWUSR);
- if (outfd == -1)
- {
- fprintf(stderr,
- _("%s: could not open log file \"%s\": %s\n"),
- progname, outfile, strerror(errno));
- goto error;
- }
- }
-
bytes_left = r - hdr_len;
bytes_written = 0;