fgetpos/ftell broken for memory streams in sarge
Hi,
It seems that fgetpos/ftell are broken for memory streams in sarge (2.3.2.ds1-22).
The following example does not work as expected:
#define _GNU_SOURCE
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
int main( int argc, char* argv [] )
{
int i;
char ch;
FILE *is;
fpos_t pos;
char buffer[] = {"Hola mundo"};
is = fmemopen( buffer, sizeof(buffer),"r+");
for ( i = 0; i < strlen(buffer) ; i++ ){
fread( &ch, sizeof(char), 1, is );
printf( " fgetpos(is, &pos) : %d\n" , fgetpos(is, &pos) );
}
fclose(is);
return 0;
}
the output on sarge is:
fgetpos(is, &pos) : 0
fgetpos(is, &pos) : -1
fgetpos(is, &pos) : -1
fgetpos(is, &pos) : -1
fgetpos(is, &pos) : -1
fgetpos(is, &pos) : -1
fgetpos(is, &pos) : -1
fgetpos(is, &pos) : -1
fgetpos(is, &pos) : -1
fgetpos(is, &pos) : -1
The very same example using etch libc6 (2.3.5) works as expected (fgetpos returns always 0). errno is always 0, even in sarge.
I didn't find any bug in BTS regarding this. If this is a bug, should I submit it to BTS?
Thanks a lot.
Eneko.
Reply to: