[Bug 5930] Improper return value of fwrite in bytes,

bugzilla at busybox.net bugzilla at busybox.net
Thu Feb 14 12:40:48 UTC 2013


https://bugs.busybox.net/show_bug.cgi?id=5930

--- Comment #4 from upendra <upendrabaveja at gmail.com> 2013-02-14 12:41:10 UTC ---
(In reply to comment #3)
> (In reply to comment #2)
> > (In reply to comment #1)
> > > fwrite does return the number of elements written. See libc/stdio/fwrite.c, 
> > > return __stdio_fwrite()/size.
> > > 
> > > can you please attach your .config (which STDIO_BUFF settings do you use) and
> > > it would help if you could also paste an strace -v of your failing test
> > > program.
> 
> > the same settings work with uClibc09.33. version.
> > But in uClibc 09.33.2 if i comment the following part in _WRITE.c
> >  if (errno != EINTR && errno != EAGAIN) {
> >       /* do we have other "soft" errors?*/
> >       break;
> >  }
> > code seems to work fine.
> > i have just used a normal fwrite function call with following check
> > if(fwrite(buf, sizeof(buf), 1, fp != 1) {
> >      printf("error %s\n", strerror(errno));
> 
> as you can see in the history, Denys did this to drain the buffer.
> what errno do you trip there (that was why i was asking for an strace)?

Thanks... Due to some official reasons i am not able to provide the trace.but i
will write a simple code and provide you with the strace for this failure.
The scenario was that I was writing data to sdcard and if i removed the sdcard
from device then fwrite should fail but it returns 1. Err no was set to
EIO.Same issue for if no space in sdcard ENOSPC also.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the uClibc-cvs mailing list