lseek should not yield a negative file position
This commit is contained in:
parent
5691dca9f4
commit
700641afb8
1 changed files with 5 additions and 3 deletions
|
@ -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 */
|
||||
|
|
Loading…
Reference in a new issue