1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-01-19 11:30:07 +02:00

Replace %m option with strerror(errno)

This commit is contained in:
Konstantin Knizhnik 2019-01-21 18:49:38 +03:00
parent b38aa659bd
commit bd241d8253
2 changed files with 4 additions and 3 deletions

View File

@ -49,8 +49,8 @@ typedef enum
#define FIO_FDMAX 64
#define FIO_PIPE_MARKER 0x40000000
#define SYS_CHECK(cmd) do if ((cmd) < 0) { elog(ERROR, "%s: %m", #cmd); exit(EXIT_FAILURE); } while (0)
#define IO_CHECK(cmd, size) do { int _rc = (cmd); if (_rc != (size)) { elog(ERROR, "%s:%d: proceeds %d bytes instead of %d\n", __FILE__, __LINE__, _rc, (int)(size)); exit(EXIT_FAILURE); } } while (0)
#define SYS_CHECK(cmd) do if ((cmd) < 0) { elog(ERROR, "%s: %s", #cmd, strerror(errno)); exit(EXIT_FAILURE); } while (0)
#define IO_CHECK(cmd, size) do { int _rc = (cmd); if (_rc != (size)) { elog(ERROR, "%s:%d: proceeds %d bytes instead of %d: %s\n", __FILE__, __LINE__, _rc, (int)(size), strerror(errno)); exit(EXIT_FAILURE); } } while (0)
typedef struct
{

View File

@ -138,7 +138,8 @@ int remote_execute(int argc, char* argv[], bool listen)
SYS_CHECK(close(errfd[0]));
SYS_CHECK(close(errfd[1]));
SYS_CHECK(execvp(ssh_argv[0], ssh_argv));
if (execvp(ssh_argv[0], ssh_argv) < 0)
elog(ERROR, "Failed to spawn %s: %s", ssh_argv[0], strerror(errno));
return -1;
} else {
SYS_CHECK(close(infd[1])); /* These are being used by the child */