aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1993-02-05 15:26:54 -0800
committerJim Wilson <wilson@gcc.gnu.org>1993-02-05 15:26:54 -0800
commit2e4f4529094b990c5cc9e97133ff78d515615b81 (patch)
tree6a09d25ea530618ec90592b70708a95039318038 /gcc
parent53b01f59f941e17aeece1e1e35347e00e2e62842 (diff)
downloadgcc-2e4f4529094b990c5cc9e97133ff78d515615b81.zip
gcc-2e4f4529094b990c5cc9e97133ff78d515615b81.tar.gz
gcc-2e4f4529094b990c5cc9e97133ff78d515615b81.tar.bz2
(finclude): Error if try to include a directory.
(S_ISDIR): Add a default definition. From-SVN: r3424
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cccp.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c
index c28e3be..d5ffdaa 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -146,6 +146,10 @@ extern char *rindex ();
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#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. */
#ifndef NULL
@@ -4151,7 +4155,11 @@ finclude (f, fname, op, system_header_p, dirptr)
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.
First read the entire file into heap and
copy them into buffer on stack. */