lseek should not yield a negative file position

This commit is contained in:
Thomas Veerman 2012-01-16 15:09:55 +00:00
parent 5691dca9f4
commit 700641afb8

View file

@ -612,9 +612,11 @@ PUBLIC int do_lseek()
newpos = sub64ul(pos, -offset);
/* Check for overflow. */
if (ex64hi(newpos) != 0)
r = EINVAL;
else {
if (ex64hi(newpos) != 0) {
r = EOVERFLOW;
} else if ((off_t) ex64lo(newpos) < 0) { /* no negative file size */
r = EOVERFLOW;
} else {
rfilp->filp_pos = newpos;
/* insert the new position into the output message */