Commit 2e4f4529 by Jim Wilson

(finclude): Error if try to include a directory.

(S_ISDIR): Add a default definition.

From-SVN: r3424
parent 53b01f59
...@@ -146,6 +146,10 @@ extern char *rindex (); ...@@ -146,6 +146,10 @@ extern char *rindex ();
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif #endif
#ifndef S_ISDIR
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
/* Define a generic NULL if one hasn't already been defined. */ /* Define a generic NULL if one hasn't already been defined. */
#ifndef NULL #ifndef NULL
...@@ -4151,7 +4155,11 @@ finclude (f, fname, op, system_header_p, dirptr) ...@@ -4151,7 +4155,11 @@ finclude (f, fname, op, system_header_p, dirptr)
st_size -= i; st_size -= i;
} }
} }
else { else if (S_ISDIR (st_mode)) {
error ("directory `%s' specified in #include", fname);
close (f);
return;
} else {
/* Cannot count its file size before reading. /* Cannot count its file size before reading.
First read the entire file into heap and First read the entire file into heap and
copy them into buffer on stack. */ copy them into buffer on stack. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment