summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2014-01-07 00:11:32 -0800
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2014-01-07 00:11:32 -0800
commit49a1ad773c3b4cd32a35f8c8d93fb560bf40a4f0 (patch)
tree07aef1e7b241007ad1cf045bf7f8d2406027c652
parentc047077911bbb6acd32eba46ee9296ca20b1e6f5 (diff)
Implementing Output's write.
-rw-r--r--src/Output.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Output.cc b/src/Output.cc
index 0ace38e..8e962be 100644
--- a/src/Output.cc
+++ b/src/Output.cc
@@ -220,8 +220,12 @@ class AsyncOpWrite : public Balau::AsyncOperation {
AsyncOpWrite(int fd, const void * buf, size_t count, off64_t offset, cbResults_t * results) : m_fd(fd), m_buf(buf), m_count(count), m_offset(offset), m_results(results) { }
virtual void run() {
#ifdef _MSC_VER
- IAssert(0, "Not yet implemented");
- const ssize_t r = 0;
+ off64_t offset = lseek(m_fd, m_offset, SEEK_SET);
+ if (offset < 0) {
+ m_results->errorno = errno;
+ return;
+ }
+ const ssize_t r = m_results->result = write(m_fd, m_buf, m_count);
#else
const ssize_t r = m_results->result = pwrite(m_fd, m_buf, m_count, m_offset);
#endif