Verified Commit ee2a94b4 authored by Marc Vef's avatar Marc Vef
Browse files

lseek() fix: Do not allow negative offsets for whence `SEEK_SET`

parent e0099267
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -418,6 +418,10 @@ off_t gkfs_lseek(unsigned int fd, off_t offset, unsigned int whence) {
off_t gkfs_lseek(shared_ptr<gkfs::filemap::OpenFile> gkfs_fd, off_t offset, unsigned int whence) {
    switch (whence) {
        case SEEK_SET:
            if (offset < 0) {
                errno = EINVAL;
                return -1;
            }
            gkfs_fd->pos(offset);
            break;
        case SEEK_CUR: