Skip to content

Commit 3e970d1

Browse files
committed
Use elog instead of fprintf(stderr) for remote IO errors
1 parent 4ceee57 commit 3e970d1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
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) { perror(#cmd); exit(EXIT_FAILURE); } while (0)
53-
#define IO_CHECK(cmd, size) do { int _rc = (cmd); if (_rc != (size)) { fprintf(stderr, "%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: %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)
5454

5555
typedef struct
5656
{

0 commit comments

Comments
 (0)