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.
This commit is contained in:
Nick Clifton
2017-06-26 13:25:41 +01:00
parent a3aea05a66
commit 0602cdad74
2 changed files with 8 additions and 0 deletions

View File

@@ -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)