mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
Kernel: Add Inode::truncate(size).
- Use this to implement the O_TRUNC open flag. - Fix creat() to pass O_CREAT | O_TRUNC | O_WRONLY. - Make sure we truncate wherever appropriate.
This commit is contained in:
@@ -645,7 +645,7 @@ void GTextEditor::Line::truncate(int length)
|
||||
|
||||
bool GTextEditor::write_to_file(const String& path)
|
||||
{
|
||||
int fd = open(path.characters(), O_WRONLY | O_CREAT, 0666);
|
||||
int fd = open(path.characters(), O_WRONLY | O_CREAT | O_TRUNC, 0666);
|
||||
if (fd < 0) {
|
||||
perror("open");
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user