X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=binutils%2Fbucomm.c;h=d3a8d2d978938b57a300d1b788a499b6594a5a37;hb=6688183925d82d4049931e95bc4e963ab66e770d;hp=22bf24aeb763c23842a38d5be9ebbfeab922de6a;hpb=aac502f7d7899d96477fbd83f0038235af641def;p=deliverable%2Fbinutils-gdb.git diff --git a/binutils/bucomm.c b/binutils/bucomm.c index 22bf24aeb7..d3a8d2d978 100644 --- a/binutils/bucomm.c +++ b/binutils/bucomm.c @@ -1,5 +1,5 @@ /* bucomm.c -- Bin Utils COMmon code. - Copyright (C) 1991-2016 Free Software Foundation, Inc. + Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -587,6 +587,9 @@ get_file_size (const char * file_name) { struct stat statbuf; + if (file_name == NULL) + return (off_t) -1; + if (stat (file_name, &statbuf) < 0) { if (errno == ENOENT) @@ -595,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)