basebackup_to_shell: Check for a NULL return from OpenPipeStream.
authorRobert Haas <[email protected]>
Wed, 12 Apr 2023 15:37:13 +0000 (11:37 -0400)
committerRobert Haas <[email protected]>
Wed, 12 Apr 2023 15:37:13 +0000 (11:37 -0400)
Per complaint from Peter Eisentraut.

Discussion: http://postgr.es/m/4f1707cc-2432-da35-64a2-5c2a8d92a388@enterprisedb.com

contrib/basebackup_to_shell/basebackup_to_shell.c

index 29f5069d427baaa0f4063809ddc560b835612b0a..57ed587d4888e1a41403164686a4df5201180381 100644 (file)
@@ -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)));
 }
 
 /*