mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-05 15:15:42 +00:00
Fix binutils tools so that they can cope with the special /dev/null file when run on Windows systems.
PR 27252 * bucomm.c (get_file_size): Add code to handle /dev/null on Windows systems. * elfedit.c (check_file): Likewise.
This commit is contained in:
committed by
Nick Clifton
parent
0318cca493
commit
a7ad3cb1ff
@@ -623,6 +623,21 @@ get_file_size (const char * file_name)
|
||||
else if (statbuf.st_size < 0)
|
||||
non_fatal (_("Warning: '%s' has negative size, probably it is too large"),
|
||||
file_name);
|
||||
#if defined (_WIN32) && !defined (__CYGWIN__)
|
||||
else if (statbuf.st_size == 0)
|
||||
{
|
||||
/* MS-Windows 'stat' doesn't reports the null device as a
|
||||
regular file; fix that. */
|
||||
int fd = open (file_name, O_RDONLY | O_BINARY);
|
||||
if (isatty (fd))
|
||||
{
|
||||
close (fd);
|
||||
non_fatal (_("Warning: '%s' is not an ordinary file"),
|
||||
/* libtool wants to see /dev/null in the output. */
|
||||
strcasecmp (file_name, "nul") ? file_name : "/dev/null");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else
|
||||
return statbuf.st_size;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user