about summary refs log tree commit diff
path: root/include/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/debug.h')
-rw-r--r--include/debug.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/include/debug.h b/include/debug.h
index f9ebce58..e6d3c3fc 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -273,13 +273,15 @@
 /* Error-checking versions of read() and write() that call RPFATAL() as
    appropriate. */
 
-#define ck_write(fd, buf, len, fn)                            \
-  do {                                                        \
-                                                              \
-    s32 _len = (s32)(len);                                    \
-    s32 _res = write(fd, buf, _len);                          \
-    if (_res != _len) RPFATAL(_res, "Short write to %s", fn); \
-                                                              \
+#define ck_write(fd, buf, len, fn)                                        \
+  do {                                                                    \
+                                                                          \
+    int _fd = (fd);                                                       \
+                                                                          \
+    s32 _len = (s32)(len);                                                \
+    s32 _res = write(_fd, (buf), _len);                                   \
+    if (_res != _len) RPFATAL(_res, "Short write to %s, fd %d", fn, _fd); \
+                                                                          \
   } while (0)
 
 #define ck_read(fd, buf, len, fn)                              \