mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-29 20:20:43 +00:00
seeking to 1 byte before the beginning of the file doesn't seem to be such
a good idea
This commit is contained in:
parent
bbb4574f01
commit
8b46193e4d
1 changed files with 8 additions and 2 deletions
|
@ -425,8 +425,14 @@ Qseek (QFile *file, long offset, int whence)
|
||||||
res = fseek (file->file, offset, whence);
|
res = fseek (file->file, offset, whence);
|
||||||
break;
|
break;
|
||||||
case SEEK_END:
|
case SEEK_END:
|
||||||
res = fseek (file->file,
|
if (file->size == -1) {
|
||||||
file->start + file->size - offset, SEEK_SET);
|
// we don't know the size (due to writing) so punt and
|
||||||
|
// pass on the request as-is
|
||||||
|
res = fseek (file->file, offset, SEEK_END);
|
||||||
|
} else {
|
||||||
|
res = fseek (file->file,
|
||||||
|
file->start + file->size - offset, SEEK_SET);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
|
|
Loading…
Reference in a new issue