diff options
| author | Mattias Andrée <maandree@kth.se> | 2017-07-23 22:55:14 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2017-07-23 22:55:14 +0200 |
| commit | d391ca2ddb719d2478e824dec082b849613eeda6 (patch) | |
| tree | 93f34a065a571f51101a0c884ae982c2cb65cbf2 /src/util/efunc.h | |
| parent | blind-primary-key: remove ./ and make more portable (diff) | |
| download | blind-d391ca2ddb719d2478e824dec082b849613eeda6.tar.gz blind-d391ca2ddb719d2478e824dec082b849613eeda6.tar.bz2 blind-d391ca2ddb719d2478e824dec082b849613eeda6.tar.xz | |
Fix support for using sockets insteads of pipes
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/util/efunc.h')
| -rw-r--r-- | src/util/efunc.h | 12 |
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) { |
