From 2e4f4529094b990c5cc9e97133ff78d515615b81 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Fri, 5 Feb 1993 15:26:54 -0800 Subject: [PATCH] (finclude): Error if try to include a directory. (S_ISDIR): Add a default definition. From-SVN: r3424 --- gcc/cccp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/cccp.c b/gcc/cccp.c index c28e3be624e..d5ffdaaeeff 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. */ -- 2.30.2