From: Christos Zoulas Date: Mon, 24 Jun 2019 20:07:36 +0000 (+0000) Subject: increment nl when we don't have CSV_LINES X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2e4c2bdbe846f08b7863bc1412ffbb3e8d1f34b7;p=file increment nl when we don't have CSV_LINES require that we have > 0 fields for CSV --- diff --git a/src/is_csv.c b/src/is_csv.c index 4f167e05..ea37844e 100644 --- a/src/is_csv.c +++ b/src/is_csv.c @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: is_csv.c,v 1.1 2019/06/08 22:16:57 christos Exp $") +FILE_RCSID("@(#)$File: is_csv.c,v 1.2 2019/06/24 20:07:36 christos Exp $") #endif #include @@ -105,9 +105,10 @@ csv_parse(const unsigned char *uc, const unsigned char *ue) break; case '\n': DPRINTF("%zu %zu %zu\n", nl, nf, tf); + nl++; #if CSV_LINES - if (nl++ == CSV_LINES) - return tf == nf; + if (nl == CSV_LINES) + return tf != 0 && tf == nf; #endif if (nf == 0) break;