On Tue, Aug 4, 2009 at 19:34, Sverre Rabbelier<srabbelier@xxxxxxxxx> wrote: > On Tue, Aug 4, 2009 at 10:26, Alex Riesen<raa.lkml@xxxxxxxxx> wrote: >> } >> + if (len > 1 && buf[len - 2] == '\r') >> + buf[--len - 1] = '\n'; >> buf[len] = '\0'; > > How about something like: > > + if (len > 1 && buf[len - 2] == '\r' && (buf[len - 1] == '\n' > || buf[len - 1] == '\0')) > + buf[--len - 1] = '\n'; > > To make sure that we're not erasing a \r somewhere in the middle of the content? I think this should be enough: if (c == '\n' && len > 1 && buf[len - 2] == '\r') buf[--len - 1] = '\n'; I'll resend. -- 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