diff options
author | Paul Smith <psmith@gnu.org> | 2013-09-15 16:41:42 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2013-09-15 17:09:01 -0400 |
commit | 1b9024889384fc26d296ee4340ffca32e8c73017 (patch) | |
tree | 88312b516ca64a727dffcbe87bf9aec3674e7a92 /read.c | |
parent | a4d8444b594e53b13659a9f2c64424418f255e27 (diff) | |
download | gunmake-1b9024889384fc26d296ee4340ffca32e8c73017.tar.gz |
[SV 27374] Fatal immediately on unrecoverable fopen() errors.
Diffstat (limited to 'read.c')
-rw-r--r-- | read.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -353,10 +353,24 @@ eval_makefile (const char *filename, int flags) filename = expanded; } - ebuf.fp = fopen (filename, "r"); + ENULLLOOP (ebuf.fp, fopen (filename, "r")); + /* Save the error code so we print the right message later. */ makefile_errno = errno; + /* Check for unrecoverable errors: out of mem or FILE slots. */ + switch (makefile_errno) + { +#ifdef EMFILE + case EMFILE: +#endif +#ifdef ENFILE + case ENFILE: +#endif + case ENOMEM: + fatal (reading_file, "%s", strerror (makefile_errno)); + } + /* If the makefile wasn't found and it's either a makefile from the 'MAKEFILES' variable or an included makefile, search the included makefile search path for this makefile. */ |