summaryrefslogtreecommitdiff
path: root/read.c
diff options
context:
space:
mode:
Diffstat (limited to 'read.c')
-rw-r--r--read.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/read.c b/read.c
index 834c7f8..f8542b0 100644
--- a/read.c
+++ b/read.c
@@ -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. */