mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:27:45 +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:
parent
e9f2cc3595
commit
0058da734e
8 changed files with 26 additions and 8 deletions
|
@ -34,7 +34,7 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int dst_fd = open(dst_path.characters(), O_WRONLY | O_CREAT, 0666);
|
||||
int dst_fd = creat(dst_path.characters(), 0666);
|
||||
if (dst_fd < 0) {
|
||||
if (errno != EISDIR) {
|
||||
perror("open dst");
|
||||
|
@ -45,7 +45,7 @@ int main(int argc, char** argv)
|
|||
builder.append('/');
|
||||
builder.append(FileSystemPath(src_path).basename());
|
||||
dst_path = builder.to_string();
|
||||
dst_fd = open(dst_path.characters(), O_WRONLY | O_CREAT, 0666);
|
||||
dst_fd = creat(dst_path.characters(), 0666);
|
||||
if (dst_fd < 0) {
|
||||
perror("open dst");
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue