]> granicus.if.org Git - file/commitdiff
increment nl when we don't have CSV_LINES
authorChristos Zoulas <christos@zoulas.com>
Mon, 24 Jun 2019 20:07:36 +0000 (20:07 +0000)
committerChristos Zoulas <christos@zoulas.com>
Mon, 24 Jun 2019 20:07:36 +0000 (20:07 +0000)
require that we have > 0 fields for CSV

src/is_csv.c

index 4f167e05318241d2bc1884834efbf9e621cafa74..ea37844e150db1c0d52ed351e99d0dab400c8303 100644 (file)
@@ -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 <string.h>
@@ -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;