X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=file.c;h=c69a297323132428c0ab16faf48a75a01d9a4981;hp=c2b0e721da417cbbf000252cca3c0d2d83e4e992;hb=28608b5321bc48a25ded6f2b062db61cf8925f32;hpb=6f251b7f609c932949a1951bd8cf2bcaae1ebcbf diff --git a/file.c b/file.c index c2b0e72..c69a297 100644 --- a/file.c +++ b/file.c @@ -60,7 +60,10 @@ __private void uci_getln(struct uci_context *ctx, int offset) ofs += strlen(p); if (pctx->buf[ofs - 1] == '\n') { pctx->line++; - pctx->buf[ofs - 1] = 0; + if (ofs >= 2 && pctx->buf[ofs - 2] == '\r') + pctx->buf[ofs - 2] = 0; + else + pctx->buf[ofs - 1] = 0; return; }