[uClibc 0000420]: ftell reports wrong position

bugs at busybox.net bugs at busybox.net
Thu Sep 8 10:13:45 UTC 2005


The following issue has been SUBMITTED. 
====================================================================== 
http://busybox.net/bugs/view.php?id=420 
====================================================================== 
Reported By:                stoecker
Assigned To:                uClibc
====================================================================== 
Project:                    uClibc
Issue ID:                   420
Category:                   Architecture Specific
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             09-08-2005 03:13 PDT
Last Modified:              09-08-2005 03:13 PDT
====================================================================== 
Summary:                    ftell reports wrong position
Description: 
When opening a file with fopen(file, "a"), the data is appended correctly,
but the file position is illegal. It is 0 at the start of writing, whereas
it should be the file size

The following example shows this problem. The numbers outputted should
differ only by 1 and not by filesize as they do now.

#include <stdio.h>

int main(void)
{
  FILE *fh;
  int i;
  fh = fopen("shit", "ab");
  i = fseek(fh, 0, SEEK_END);
  fprintf(fh, "x");
  printf("%d %d\n", i, ftell(fh));
  fclose(fh);
  fh = fopen("shit", "ab");
  fprintf(fh, "\n");
  printf("%d %d\n", i, ftell(fh));
  fclose(fh);
  return 0;
}
====================================================================== 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
09-08-05 03:13  stoecker       New Issue                                    
09-08-05 03:13  stoecker       Status                   new => assigned     
09-08-05 03:13  stoecker       Assigned To               => uClibc          
======================================================================




More information about the uClibc-cvs mailing list