From 7532dc26edc72f4ec98acd0a62e1b02994c34171 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 30 Mar 2013 19:12:40 +0000 Subject: [PATCH] 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. --- file_write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.39.2