#1398 closed defect (fixed)

seek with size beyond end, cause grow for readonly file

Reported by: Nickolay Semyonov-Kolchin Owned by: Joel Sherrill
Priority: normal Milestone: 4.11
Component: score Version: 4.9
Severity: normal Keywords:
Cc: chrisj@…, sebastian.huber@…, medivhc@… Blocked By:
Blocking:

Description

Sample code:

we expect that filename exists
static void test_lseek(const char* filename)
{

int fd; = open(filename, O_RDONLY);
int rc;
struct stat st;
stat(filename, &st);
printf("size: %i\n", st.st_size); size: 0, for example
fd = open(filename, O_RDONLY);
rc = lseek(fd, 1000, SEEK_END);
printf("lseek result = %i\n", rc);
close(fd);
stat(filename, &st);
printf("size: %i\n", st.st_size);
size: 1000 <-- BUG

}

  • This can be reproduced for both FAT and IMFS.

Expected results: no grow for readonly files.

Change History (4)

comment:1 Changed on Apr 20, 2010 at 10:56:53 PM by Chris Johns

Cc: Chris Johns added

comment:2 Changed on Aug 1, 2011 at 12:38:01 PM by Xiang Cui

Cc: Xiang Cui added

comment:3 Changed on May 7, 2012 at 1:20:49 PM by Sebastian Huber

Cc: Sebastian Huber added

comment:4 Changed on May 11, 2012 at 11:04:06 AM by Sebastian Huber

Milestone: 4.104.11
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.