[uClibc 0001440]: fputc sets invalid stream->__bufpos when __WRITE fails

bugs at busybox.net bugs at busybox.net
Tue Jul 24 20:09:30 UTC 2007


The following issue has been SUBMITTED. 
====================================================================== 
http://busybox.net/bugs/view.php?id=1440 
====================================================================== 
Reported By:                Dwight Engen
Assigned To:                uClibc
====================================================================== 
Project:                    uClibc
Issue ID:                   1440
Category:                   Stdio
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             07-24-2007 13:09 PDT
Last Modified:              07-24-2007 13:09 PDT
====================================================================== 
Summary:                    fputc sets invalid stream->__bufpos when __WRITE
fails
Description: 
Attached is a test case and a fix for a bug in uclibc fputc when write(2)
returns an error. The internal stream->__bufpos is set incorrectly. This
could happen on a real system when for example the disk is full. We
simulate it here by setting RLIMIT_FSIZE very small. The stream must be in
line buffered mode.   
  
The reasoning for the fix is that __stdio_WRITE already has reduced
stream->__bufpos for the \n so there is no need for fputc to
__STDIO_STREAM_BUFFER_UNADD.   

Note that with glibc, it appears the stream gets purged when an error on  

write occurs, uclibc's attempt to buffer the data in the stream is   
nicer.   

====================================================================== 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
07-24-07 13:09  Dwight Engen   New Issue                                    
07-24-07 13:09  Dwight Engen   Status                   new => assigned     
07-24-07 13:09  Dwight Engen   Assigned To               => uClibc          
07-24-07 13:09  Dwight Engen   File Added: testit.c                         
======================================================================




More information about the uClibc-cvs mailing list