missing_exit_on_error_in_pgbasebackup_v2.patch

application/octet-stream

Filename: missing_exit_on_error_in_pgbasebackup_v2.patch
Type: application/octet-stream
Part: 0
Message: Re: PATCH: pg_basebackup (missing exit on error)

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: context
Series: patch v2
File+
src/bin/pg_basebackup/pg_basebackup.c 20 0
*** a/src/bin/pg_basebackup/pg_basebackup.c
--- b/src/bin/pg_basebackup/pg_basebackup.c
***************
*** 584,589 **** ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
--- 584,590 ----
  				{
  					fprintf(stderr, _("%s: could not write to compressed file \"%s\": %s\n"),
  							progname, filename, get_gz_error(ztarfile));
+ 					disconnect_and_exit(1);
  				}
  			}
  			else
***************
*** 597,617 **** ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
  				}
  			}
  
- 			if (strcmp(basedir, "-") == 0)
- 			{
  #ifdef HAVE_LIBZ
! 				if (ztarfile)
! 					gzclose(ztarfile);
! #endif
  			}
  			else
- 			{
- #ifdef HAVE_LIBZ
- 				if (ztarfile != NULL)
- 					gzclose(ztarfile);
  #endif
! 				if (tarfile != NULL)
! 					fclose(tarfile);
  			}
  
  			break;
--- 598,625 ----
  				}
  			}
  
  #ifdef HAVE_LIBZ
! 			if (ztarfile != NULL)
! 			{
! 				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
  #endif
! 			{
! 				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;
***************
*** 630,635 **** ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
--- 638,644 ----
  			{
  				fprintf(stderr, _("%s: could not write to compressed file \"%s\": %s\n"),
  						progname, filename, get_gz_error(ztarfile));
+ 				disconnect_and_exit(1);
  			}
  		}
  		else