(finclude): Error if try to include a directory.
authorJim Wilson <wilson@gcc.gnu.org>
Fri, 5 Feb 1993 23:26:54 +0000 (15:26 -0800)
committerJim Wilson <wilson@gcc.gnu.org>
Fri, 5 Feb 1993 23:26:54 +0000 (15:26 -0800)
(S_ISDIR): Add a default definition.

From-SVN: r3424

gcc/cccp.c

index c28e3be..d5ffdaa 100644 (file)
@@ -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. */