This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Produce a consistent warning message when attempting to run a tool on a directory.
- From: Nick Clifton <nickc at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 26 Jun 2017 12:27:01 -0000
- Subject: [binutils-gdb] Produce a consistent warning message when attempting to run a tool on a directory.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0602cdad745472ed2561d8096a4bb021c8d0301d
commit 0602cdad745472ed2561d8096a4bb021c8d0301d
Author: Nick Clifton <nickc@redhat.com>
Date: Mon Jun 26 13:25:41 2017 +0100
Produce a consistent warning message when attempting to run a tool on a directory.
PR binutils/21659
* bucomm.c (get_file_size): Explicitly warn if the file is a
directory.
Diff:
---
binutils/ChangeLog | 6 ++++++
binutils/bucomm.c | 2 ++
2 files changed, 8 insertions(+)
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index cc4003c..6810c22 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2017-06-26 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21659
+ * bucomm.c (get_file_size): Explicitly warn if the file is a
+ directory.
+
2017-06-24 Thomas Preud'homme <thomas.preudhomme@arm.com>
* readelf.c (arm_attr_tag_CPU_arch): Fill value for ARMv8-R.
diff --git a/binutils/bucomm.c b/binutils/bucomm.c
index fd6f356..5a0b634 100644
--- a/binutils/bucomm.c
+++ b/binutils/bucomm.c
@@ -598,6 +598,8 @@ get_file_size (const char * file_name)
non_fatal (_("Warning: could not locate '%s'. reason: %s"),
file_name, strerror (errno));
}
+ else if (S_ISDIR (statbuf.st_mode))
+ non_fatal (_("Warning: '%s' is a directory"), file_name);
else if (! S_ISREG (statbuf.st_mode))
non_fatal (_("Warning: '%s' is not an ordinary file"), file_name);
else if (statbuf.st_size < 0)