seek(2) now correctly rejects a bad whence value.

This commit is contained in:
Jonas 'Sortie' Termansen 2012-04-10 13:20:33 +02:00
parent 6367a2352e
commit 36ff6c7f96
1 changed files with 1 additions and 1 deletions

View File

@ -146,7 +146,7 @@ namespace Sortix
case SEEK_SET: origin = 0; break;
case SEEK_CUR: origin = buffer->Position(); break;
case SEEK_END: origin = buffer->Size(); break;
default: Error::Set(EINVAL); *offset = -1; break;
default: Error::Set(EINVAL); *offset = -1; return;
}
off_t newposition = origin + *offset;
if ( newposition < 0 ) { Error::Set(EINVAL); *offset = -1; return; }