about summary refs log tree commit diff
path: root/src/store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-07-20T21·11+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-07-20T21·11+0000
commit7984cfc7c18c85c5db42c5c7d57927b12c846ce0 (patch)
treea728a7500892e4de089c090538cb8fd34e4a1ffa /src/store.cc
parent667a6afb9dabcb3e5c851b910705b7eb1c87c9b6 (diff)
* Argh, another short-write problem. Added wrappers around
  read()/write() to fix this once and for all.

Diffstat (limited to 'src/store.cc')
-rw-r--r--src/store.cc11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/store.cc b/src/store.cc
index 0ce5f26044fb..6f1a2fc39d1c 100644
--- a/src/store.cc
+++ b/src/store.cc
@@ -15,8 +15,7 @@ struct CopySink : DumpSink
     int fd;
     virtual void operator () (const unsigned char * data, unsigned int len)
     {
-        if (write(fd, (char *) data, len) != (ssize_t) len)
-            throw SysError("writing to child");
+        writeFull(fd, data, len);
     }
 };
 
@@ -24,13 +23,9 @@ struct CopySink : DumpSink
 struct CopySource : RestoreSource
 {
     int fd;
-    virtual void operator () (const unsigned char * data, unsigned int len)
+    virtual void operator () (unsigned char * data, unsigned int len)
     {
-        ssize_t res = read(fd, (char *) data, len);
-        if (res == -1)
-            throw SysError("reading from parent");
-        if (res != (ssize_t) len)
-            throw Error("not enough data available on parent");
+        readFull(fd, data, len);
     }
 };