From 2e4c2bdbe846f08b7863bc1412ffbb3e8d1f34b7 Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Mon, 24 Jun 2019 20:07:36 +0000 Subject: [PATCH] increment nl when we don't have CSV_LINES require that we have > 0 fields for CSV --- src/is_csv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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; -- 2.49.0