Fix ReadFileToBuffer to return 0 on failure (-1 is too large if returned as size_t).

llvm-svn: 156538
This commit is contained in:
Alexander Potapenko 2012-05-10 12:03:09 +00:00
parent b16ff5d1ce
commit 66e6de10cf
1 changed files with 1 additions and 1 deletions

View File

@ -86,7 +86,7 @@ size_t ReadFileToBuffer(const char *file_name, char **buff,
// The files we usually open are not seekable, so try different buffer sizes.
for (size_t size = kMinFileLen; size <= max_len; size *= 2) {
int fd = AsanOpenReadonly(file_name);
if (fd < 0) return -1;
if (fd < 0) return 0;
AsanUnmapOrDie(*buff, *buff_size);
*buff = (char*)AsanMmapSomewhereOrDie(size, __FUNCTION__);
*buff_size = size;