filename | src/tools/actparse.c |
changeset | 1169:23a9613aceb1 |
prev | 981:79fcace1ab43 |
next | 1296:30ecee61f811 |
author | nkeynes |
date | Sun Feb 12 16:30:26 2012 +1000 (12 years ago) |
permissions | -rw-r--r-- |
last change | Add -Werror for mregparm check, so it actually fails if mregparm isn't accepted |
file | annotate | diff | log | raw |
1.1 --- a/src/tools/actparse.c Sun Feb 08 23:38:41 2009 +00001.2 +++ b/src/tools/actparse.c Sun Feb 12 16:30:26 2012 +10001.3 @@ -16,6 +16,7 @@1.4 * GNU General Public License for more details.1.5 */1.7 +#include <errno.h>1.8 #include <stdlib.h>1.9 #include <stdio.h>1.10 #include <string.h>1.11 @@ -105,7 +106,12 @@1.12 af->filename = filename;1.13 af->length = st.st_size+1;1.14 af->text = malloc( st.st_size+1 );1.15 - fread( af->text, st.st_size, 1, f );1.16 + if( fread( af->text, st.st_size, 1, f ) != 1 ) {1.17 + fprintf( stderr, "Error: unable to read from file '%s' (%s)\n", filename, strerror(errno));1.18 + free(af);1.19 + fclose(f);1.20 + return NULL;1.21 + }1.22 af->text[st.st_size] = '\0';1.23 af->yyline = 1;1.24 af->yyposn = 0;1.25 @@ -113,7 +119,6 @@1.26 af->token.symbol = NONE;1.27 af->token.lineno = 1;1.28 af->token.filename = filename;1.29 -1.30 return af;1.31 }
.