Replace perror with custom postgres logging
authorDaniel Gustafsson <dgustafsson@postgresql.org>
Fri, 8 Mar 2024 21:50:20 +0000 (22:50 +0100)
committerDaniel Gustafsson <dgustafsson@postgresql.org>
Fri, 8 Mar 2024 21:50:20 +0000 (22:50 +0100)
perror() is not used in postgres anymore out of policy, this replaces
the final callsites with the custom postgres logging framework.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/89B00F63-40F7-4D82-8353-DC9CABBAC1D1@yesql.se

src/common/exec.c

index da929f15b959ddb0dd608c18004464eb816e8cbb..bcd5b71101ed0d59dd70ddb192e7800081f3a487 100644 (file)
@@ -378,7 +378,8 @@ pipe_read_line(char *cmd)
    errno = 0;
    if ((pipe_cmd = popen(cmd, "r")) == NULL)
    {
-       perror("popen failure");
+       log_error(errcode(ERRCODE_SYSTEM_ERROR),
+                 _("could not execute command \"%s\": %m"), cmd);
        return NULL;
    }