1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-16 17:07:43 +03:00

pg_restore: Require "-f -" to mean stdout

The previous convention that stdout was selected by default when nothing
is specified was just too error-prone.

After a suggestion from Andrew Gierth.
Author: Euler Taveira
Reviewed-by: Yoshikazu Imai, José Arthur Benetasso Villanova
Discussion: https://postgr.es/m/87sgwrmhdv.fsf@news-spur.riddles.org.uk
This commit is contained in:
Alvaro Herrera
2019-04-04 16:34:58 -03:00
parent 9c703c169a
commit 413ccaa74d
4 changed files with 30 additions and 12 deletions

View File

@@ -1512,7 +1512,12 @@ SetOutput(ArchiveHandle *AH, const char *filename, int compression)
int fn;
if (filename)
fn = -1;
{
if (strcmp(filename, "-") == 0)
fn = fileno(stdout);
else
fn = -1;
}
else if (AH->FH)
fn = fileno(AH->FH);
else if (AH->fSpec)