On Mon, Apr 19, 2010 at 4:43 PM, René Scharfe <rene.scharfe@xxxxxxxxxxxxxx> wrote: [...] >> + if (total + size > count) >> + size = count - total; >> + } >> + } > > Shouldn't the loop be left in the successful case, too? write(2) is > allowed to write less than requested, so the caller already needs to > deal with that case anyway. That's what I thought initially, since the code would be cleaner, but I don't like the fact that you could actually end up making a lot more failed write() calls that way, since you restart the size search on each call to mingw_write(). For example, suppose you were calling mingw_write() with a count that was exactly 11.5 times bigger than whatever maximum size write() was willing to accept. If you only did one write() per mingw_write(), letting the caller restart, this will result in 47 failed writes and 16 successes. Letting mingw_write() do the restart (as in the existing code) will end up with 4 failed writes and 16 successes. Now, I assume (wait, this is Windows-- I'd *like to hope*) that a failed write() is a lot cheaper than a successful one, but this still rubs me the wrong way. Of course, if we know (or can guess) the maximum size write() will take, that would be best. --bert -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html