forked from lix-project/lix
* Use writeFull().
This commit is contained in:
parent
9d95aafe8c
commit
c4e7d324b8
|
@ -307,8 +307,7 @@ void addTextToStore(const Path & dstPath, const string & s)
|
||||||
AutoCloseFD fd = open(dstPath.c_str(), O_CREAT | O_EXCL | O_WRONLY, 0666);
|
AutoCloseFD fd = open(dstPath.c_str(), O_CREAT | O_EXCL | O_WRONLY, 0666);
|
||||||
if (fd == -1) throw SysError(format("creating store file `%1%'") % dstPath);
|
if (fd == -1) throw SysError(format("creating store file `%1%'") % dstPath);
|
||||||
|
|
||||||
if (write(fd, s.c_str(), s.size()) != (ssize_t) s.size())
|
writeFull(fd, (unsigned char *) s.c_str(), s.size());
|
||||||
throw SysError(format("writing store file `%1%'") % dstPath);
|
|
||||||
|
|
||||||
Transaction txn(nixDB);
|
Transaction txn(nixDB);
|
||||||
registerValidPath(txn, dstPath);
|
registerValidPath(txn, dstPath);
|
||||||
|
|
Loading…
Reference in a new issue