From: Andre Noll Date: Sat, 30 Mar 2013 19:12:40 +0000 (+0000) Subject: file writer: Use xwrite() instead of plain write(). X-Git-Tag: v0.4.13~38 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=7532dc26edc72f4ec98acd0a62e1b02994c34171;ds=sidebyside file writer: Use xwrite() instead of plain write(). Currently the file writer's ->post_select() sets t->error to -1 on errors, rather than using a proper error code. This may result in a segfault when this number is passed to para_strerror(). Replacing the call to write() by xwrite() not only gives a proper error code but also treats EAGAIN as a non-fatal error. --- diff --git a/file_write.c b/file_write.c index 28fddcb6..cea21cb3 100644 --- a/file_write.c +++ b/file_write.c @@ -122,7 +122,7 @@ static int file_write_post_select(__a_unused struct sched *s, bytes = btr_next_buffer(btrn, &buf); assert(bytes > 0); //PARA_INFO_LOG("writing %zu\n", bytes); - ret = write(pfwd->fd, buf, bytes); + ret = xwrite(pfwd->fd, buf, bytes); if (ret < 0) goto out; btr_consume(btrn, ret);