mirror of
https://github.com/postgres/postgres.git
synced 2025-05-03 22:24:49 +03:00
pg_basebackup: Error handling fixes.
Thomas Ogrisegg and Fujii Masao
This commit is contained in:
parent
81f6bbe8ad
commit
ada763cfcd
@ -584,6 +584,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("%s: could not write to compressed file \"%s\": %s\n"),
|
fprintf(stderr, _("%s: could not write to compressed file \"%s\": %s\n"),
|
||||||
progname, filename, get_gz_error(ztarfile));
|
progname, filename, get_gz_error(ztarfile));
|
||||||
|
disconnect_and_exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -597,21 +598,28 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(basedir, "-") == 0)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_LIBZ
|
#ifdef HAVE_LIBZ
|
||||||
if (ztarfile)
|
if (ztarfile != NULL)
|
||||||
gzclose(ztarfile);
|
{
|
||||||
#endif
|
if (gzclose(ztarfile) != 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, _("%s: could not close compressed file \"%s\": %s\n"),
|
||||||
|
progname, filename, get_gz_error(ztarfile));
|
||||||
|
disconnect_and_exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
#ifdef HAVE_LIBZ
|
|
||||||
if (ztarfile != NULL)
|
|
||||||
gzclose(ztarfile);
|
|
||||||
#endif
|
#endif
|
||||||
if (tarfile != NULL)
|
{
|
||||||
fclose(tarfile);
|
if (strcmp(basedir, "-") != 0)
|
||||||
|
{
|
||||||
|
if (fclose(tarfile) != 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, _("%s: could not close file \"%s\": %s\n"),
|
||||||
|
progname, filename, strerror(errno));
|
||||||
|
disconnect_and_exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -630,6 +638,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("%s: could not write to compressed file \"%s\": %s\n"),
|
fprintf(stderr, _("%s: could not write to compressed file \"%s\": %s\n"),
|
||||||
progname, filename, get_gz_error(ztarfile));
|
progname, filename, get_gz_error(ztarfile));
|
||||||
|
disconnect_and_exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user