postgres.git / summary / log / commit / refs

commit    fa83e9e23ca2542d040466d820c3bf8eef930331
Author:   Robert Haas <rhaas@postgresql.org>
Date:     Wed Apr 12 15:37:13 2023 +0000
First released in: 16.0, 15.3

    basebackup_to_shell: Check for a NULL return from OpenPipeStream.
    
    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 | 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 2099e0f50d8..5a26bc61be9 100644 --- a/contrib/basebackup_to_shell/basebackup_to_shell.c +++ b/contrib/basebackup_to_shell/basebackup_to_shell.c @@ -315,6 +315,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))); } /* [parent: 749320cdc3fd]