0002-basebackup_to_shell-Add-missing-error-check.patch

application/octet-stream

Filename: 0002-basebackup_to_shell-Add-missing-error-check.patch
Type: application/octet-stream
Part: 1
Message: Re: refactoring basebackup.c

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: format-patch
Series: patch 0002
Subject: basebackup_to_shell: Add missing error check.
File+
contrib/basebackup_to_shell/basebackup_to_shell.c 5 0
From 509985230a3da4b9c6047ad38094f061660c059a Mon Sep 17 00:00:00 2001
From: Robert Haas <rhaas@postgresql.org>
Date: Fri, 24 Mar 2023 10:44:03 -0400
Subject: [PATCH 2/2] basebackup_to_shell: Add missing error check.

Per complaint from Peter Eisentraut.
---
 contrib/basebackup_to_shell/basebackup_to_shell.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/contrib/basebackup_to_shell/basebackup_to_shell.c b/contrib/basebackup_to_shell/basebackup_to_shell.c
index 29f5069d42..57ed587d48 100644
--- a/contrib/basebackup_to_shell/basebackup_to_shell.c
+++ b/contrib/basebackup_to_shell/basebackup_to_shell.c
@@ -263,6 +263,11 @@ shell_run_command(bbsink_shell *sink, const char *filename)
 
 	/* Run it. */
 	sink->pipe = OpenPipeStream(sink->current_command, PG_BINARY_W);
+	if (sink->pipe == NULL)
+		ereport(ERROR,
+				(errcode_for_file_access(),
+				 errmsg("could not execute command \"%s\": %m",
+						sink->current_command)));
 }
 
 /*
-- 
2.37.1 (Apple Git-137.1)