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

bugzilla at busybox.net bugzilla at busybox.net
Thu Feb 14 05:32:16 UTC 2013


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

           Summary: Improper return value of fwrite in bytes,
           Product: uClibc
           Version: 0.9.33.2
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P5
         Component: stdio
        AssignedTo: unassigned at uclibc.org
        ReportedBy: upendrabaveja at gmail.com
                CC: uclibc-cvs at uclibc.org
   Estimated Hours: 0.0


fwrite(buf, sizeof(buf), 1, fp)

if any error occurs such as ENOSPC or EIO, then also fwrite return value 1, but
proper error code is set.

but from the man page of fwrite:
fwrite()  return  the number of items successfully read or written (i.e., not
the number of characters).  If an error occurs, or the end-of-file is reached,
the return value is a short item count (or zero).

But it can be seen with uclibc 0.9.33.2 the return value is 1 for the above use
case in case of failure also.

This issue was not observed with uClibc version 0.9.33.

Also as seen from the code in libc/stdio/_WRITE.c the following part seems to
be culpit
 * some hidden buffered crap in the buffer.
 */
 if (errno != EINTR && errno != EAGAIN) {
        /* do we have other "soft" errors? */
           break;
  }

return bufsize;

Apart from other these 2 error it breaks out of the loop and return bufsize .

-- 
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