1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

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

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; }