Comment 4 for bug 459164

Revision history for this message
Scott Kitterman (kitterman) wrote :

[09:43:14] <ScottK> Would someone that knows C please review https://code.edge.launchpad.net/~simono/ubuntu/karmic/gnoemoe/fixes-bug-459164/+merge/13854
[09:53:48] <joaopinto> ScottK, gint count = (strlen(no_ansi) - written); it could use just "len" no need to call strlen() again
[09:54:17] <ScottK> joaopinto: Could you fix it and make a proper debbdiff?
[09:55:15] <joaopinto> well, it's a very small improvement, doesn't worth a debdiff at this time, the code looks sane
[09:56:20] <zooko> ScottK: something looks wrong to me.
[09:57:04] <zooko> Suppose strlen(no_ansi) is 20 at the start. written gets initialized to 0. First pass of the loop, count = 20
[09:57:20] <zooko> suppose partial write, written = 5, then
[09:57:41] <zooko> second pass of the loop, count = 15
[09:57:58] <zooko> so far so good -- it invokes write(fd, no_ansi+5, 15)
[09:58:10] <zooko> but if there is a second partial write, let's say this time written = 6
[09:58:33] <zooko> so 3rd pass of the loop, count = 14
[09:58:35] <joaopinto> oh written is not cumulative :\