X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fdata%2Fpor-file-reader.c;h=bba62d168f8f72fa2c8842c16bee0ad5ff85b455;hb=591e26b4995976787f89cec49f4c8a0dbf3b916c;hp=4fb6c5fb452de7fbf64a00cf3001124594d85d0e;hpb=0df9cdd3df66caf4353128feff3008289cda8115;p=pspp diff --git a/src/data/por-file-reader.c b/src/data/por-file-reader.c index 4fb6c5fb45..bba62d168f 100644 --- a/src/data/por-file-reader.c +++ b/src/data/por-file-reader.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -922,8 +922,8 @@ por_file_casereader_read (struct casereader *reader, void *r_) return c; } -/* Returns true if FILE is an SPSS portable file, - false otherwise. */ +/* Detects whether FILE is an SPSS portable file. Returns 1 if so, 0 if not, + and a negative errno value if there is an error reading FILE. */ int pfm_detect (FILE *file) { @@ -938,7 +938,7 @@ pfm_detect (FILE *file) { int c = getc (file); if (c == EOF || raw_cnt++ > 512) - return 0; + return ferror (file) ? -errno : 0; else if (c == '\n') { while (line_len < 80 && cooked_cnt < sizeof header)