3 ms·
This code is buggy because it assumes that a single write() will write out the entire file: https://gitlab.com/jeffreyrogers27/AtomicWrite/blob/8a40d050341f5d3
by agwa 9y ago
This code is buggy because it assumes that a single write() will write out the entire file:
https://gitlab.com/jeffreyrogers27/AtomicWrite/blob/8a40d050341f5d35947f1b47e73e884e5d7509ef/AtomicWrite.cpp#L31-37 https://gitlab.com/jeffreyrogers27/AtomicWrite/blob/8a40d050...
In reality, write() may write a partial amount, so you need to loop and call write() again until the entire file has been written or write() returns an error.
- jeffreyrogers 9y agoThanks, you're right. I'll fix this.