aboutsummaryrefslogtreecommitdiff
path: root/gas/read.c
diff options
context:
space:
mode:
Diffstat (limited to 'gas/read.c')
-rw-r--r--gas/read.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gas/read.c b/gas/read.c
index 06ca7fb..ede811b 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -5909,7 +5909,16 @@ s_incbin (int x ATTRIBUTE_UNUSED)
if (binfile)
{
long file_len;
+ struct stat filestat;
+ if (fstat (fileno (binfile), &filestat) != 0
+ || ! S_ISREG (filestat.st_mode)
+ || S_ISDIR (filestat.st_mode))
+ {
+ as_bad (_("unable to include `%s'"), path);
+ goto done;
+ }
+
register_dependency (path);
/* Compute the length of the file. */