aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/efunc.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/util/efunc.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/efunc.h b/src/util/efunc.h
index 03d1609..12608f8 100644
--- a/src/util/efunc.h
+++ b/src/util/efunc.h
@@ -64,6 +64,18 @@ epread(int fd, void *buf, size_t n, off_t off, const char *fname)
return (size_t)ret;
}
+static inline size_t
+ewrite(int fd, void *buf, size_t n, const char *fname)
+{
+ ssize_t ret = write(fd, buf, n);
+ if (ret < 0) {
+ if (errno = ECONNRESET)
+ raise(SIGPIPE);
+ eprintf("write %s:", fname);
+ }
+ return (size_t)ret;
+}
+
static inline off_t
elseek(int fd, off_t offset, int whence, const char *fname)
{