Skip to content

Commit bd241d8

Browse files
committed
Replace %m option with strerror(errno)
1 parent b38aa65 commit bd241d8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/utils/file.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ typedef enum
4949
#define FIO_FDMAX 64
5050
#define FIO_PIPE_MARKER 0x40000000
5151

52-
#define SYS_CHECK(cmd) do if ((cmd) < 0) { elog(ERROR, "%s: %m", #cmd); exit(EXIT_FAILURE); } while (0)
53-
#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)
52+
#define SYS_CHECK(cmd) do if ((cmd) < 0) { elog(ERROR, "%s: %s", #cmd, strerror(errno)); exit(EXIT_FAILURE); } while (0)
53+
#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)
5454

5555
typedef struct
5656
{

src/utils/remote.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ int remote_execute(int argc, char* argv[], bool listen)
138138
SYS_CHECK(close(errfd[0]));
139139
SYS_CHECK(close(errfd[1]));
140140

141-
SYS_CHECK(execvp(ssh_argv[0], ssh_argv));
141+
if (execvp(ssh_argv[0], ssh_argv) < 0)
142+
elog(ERROR, "Failed to spawn %s: %s", ssh_argv[0], strerror(errno));
142143
return -1;
143144
} else {
144145
SYS_CHECK(close(infd[1])); /* These are being used by the child */

0 commit comments

Comments
 (0)