From: Thomas Veerman Date: Mon, 16 Jan 2012 15:09:55 +0000 (+0000) Subject: lseek should not yield a negative file position X-Git-Tag: v3.2.0~111 X-Git-Url: http://zhaoyanbai.com/repos//%22http:/%22%29?a=commitdiff_plain;h=700641afb86c7615377fa78b5df448ffaaa50c0f;p=minix.git lseek should not yield a negative file position --- diff --git a/servers/avfs/open.c b/servers/avfs/open.c index a236107fd..e3cbf4470 100644 --- a/servers/avfs/open.c +++ b/servers/avfs/open.c @@ -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 */