This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug stdio/20005] New: fflush on a file opened with fmemopen resets position to 0
- From: "gbs at panix dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Tue, 26 Apr 2016 19:24:13 +0000
- Subject: [Bug stdio/20005] New: fflush on a file opened with fmemopen resets position to 0
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=20005
Bug ID: 20005
Summary: fflush on a file opened with fmemopen resets position
to 0
Product: glibc
Version: 2.23
Status: NEW
Severity: critical
Priority: P2
Component: stdio
Assignee: unassigned at sourceware dot org
Reporter: gbs at panix dot com
Target Milestone: ---
As of 2.23 glibc seems to have changed its behavior on an fflush of a stream
created with fmemopen, in that it resets the file position to 0.
Here's some sample code:
char buffer[500] = "x";
FILE *stream;
stream = fmemopen(buffer, 500, "r+");
fwrite("fish",sizeof(char),5,stream);
printf("pos-1:%ld\n",ftell(stream));
fflush(stream);
printf("pos-2:%ld\n",ftell(stream));
On earlier versions this would result in:
pos-1:5
pos-2:5
Now it returns:
pos-1:5
pos-2:0
I verified this using Ubuntu 15.10 for the earlier version, and 16.04 for 2.23.
--
You are receiving this mail because:
You are on the CC list for the bug.