aboutsummaryrefslogtreecommitdiff
path: root/src/references.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-07-20 21:11:43 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-07-20 21:11:43 +0000
commit7984cfc7c18c85c5db42c5c7d57927b12c846ce0 (patch)
treea728a7500892e4de089c090538cb8fd34e4a1ffa /src/references.cc
parent667a6afb9dabcb3e5c851b910705b7eb1c87c9b6 (diff)
* Argh, another short-write problem. Added wrappers around
read()/write() to fix this once and for all.
Diffstat (limited to 'src/references.cc')
-rw-r--r--src/references.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/references.cc b/src/references.cc
index a42c1aed0..8934d5306 100644
--- a/src/references.cc
+++ b/src/references.cc
@@ -55,12 +55,11 @@ void checkPath(const string & path,
int fd = open(path.c_str(), O_RDONLY);
if (fd == -1) throw SysError(format("opening file `%1%'") % path);
- char * buf = new char[st.st_size];
+ unsigned char * buf = new unsigned char[st.st_size];
- if (read(fd, buf, st.st_size) != st.st_size)
- throw SysError(format("reading file %1%") % path);
+ readFull(fd, buf, st.st_size);
- search(string(buf, st.st_size), ids, seen);
+ search(string((char *) buf, st.st_size), ids, seen);
delete buf; /* !!! autodelete */