diff --git a/autotest/LoadProcFile/LoadProcFile.cpp b/autotest/LoadProcFile/LoadProcFile.cpp index e196ab165..7bc3bc37f 100644 --- a/autotest/LoadProcFile/LoadProcFile.cpp +++ b/autotest/LoadProcFile/LoadProcFile.cpp @@ -8,4 +8,10 @@ CONSOLE_APP_MAIN Cout() << s; ASSERT(s.GetCount() > 0); ASSERT(LoadFile("/proc/this_file_does_not_exist").IsVoid()); + String path = GetHomeDirFile("empty_file"); + SaveFile(path, String()); + s = LoadFile(path); + DDUMP(s.GetCount()); + ASSERT(!s.IsVoid() && s.GetCount() == 0); + DeleteFile(path); } diff --git a/uppsrc/Core/Stream.cpp b/uppsrc/Core/Stream.cpp index 9822eb435..3a30e602f 100644 --- a/uppsrc/Core/Stream.cpp +++ b/uppsrc/Core/Stream.cpp @@ -1227,7 +1227,7 @@ String LoadFile(const char *filename) { s.SetCount(n + CHUNK); int len = read(fd, ~s + n, CHUNK); if(len != CHUNK) { - if(len > 0) + if(len >= 0) s.SetCount(n + len); return s; }