mirror of
https://github.com/NixOS/nix
synced 2025-07-05 04:01:47 +02:00
* Argh, another short-write problem. Added wrappers around
read()/write() to fix this once and for all.
This commit is contained in:
parent
667a6afb9d
commit
7984cfc7c1
9 changed files with 46 additions and 36 deletions
|
@ -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 */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue