ramfs now supports O_TRUNC.

This commit is contained in:
Jonas 'Sortie' Termansen 2011-11-21 00:12:20 +01:00
parent 23fde42249
commit 0b90ab534f
1 changed files with 6 additions and 1 deletions

View File

@ -263,7 +263,12 @@ namespace Sortix
if ( files )
{
size_t fileindex = files->Search(LookupFile, path);
if ( fileindex != SIZE_MAX ) { return files->Get(fileindex); }
if ( fileindex != SIZE_MAX )
{
DevRAMFSFile* file = files->Get(fileindex);
if ( flags & O_TRUNC ) { file->Resize(0); }
return file;
}
}
return CreateFile(path, flags, mode);