Skip to content

Commit

Permalink
reading empty file
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya Dogolazky committed Jul 28, 2011
1 parent 6016adb commit 643d14d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/storage.cpp
Expand Up @@ -388,7 +388,13 @@ int storage::read_file_to_string(const char *file, string &input)

int size = st.st_size ;

if(size<=0)
if (size==0)
{
input.resize(0) ;
return 0 ;
}

if(size<0)
{
close(fd) ;
errno = EIO ; // TODO find a better one?
Expand Down

0 comments on commit 643d14d

Please sign in to comment.