]> git.mxchange.org Git - simgear.git/blobdiff - simgear/io/sg_file.cxx
Use the new SGPath::create_dir function
[simgear.git] / simgear / io / sg_file.cxx
index 079fefec7283dd90c54c12d991605ad7a915f050..dace6454060c5e7bad2b100587f0ef2e6e3f84ab 100644 (file)
@@ -29,6 +29,7 @@
 #  include <io.h>
 #endif
 
+#include <simgear/misc/stdint.hxx>
 #include <simgear/debug/logstream.hxx>
 
 #include "sg_file.hxx"
@@ -80,7 +81,7 @@ bool SGFile::open( const SGProtocolDir d ) {
 int SGFile::read( char *buf, int length ) {
     // read a chunk
     ssize_t result = ::read( fp, buf, length );
-    if ( result == 0 ) {
+    if ( length > 0 && result == 0 ) {
         eof_flag = true;
     }
     return result;
@@ -94,7 +95,7 @@ int SGFile::readline( char *buf, int length ) {
 
     // read a chunk
     ssize_t result = ::read( fp, buf, length );
-    if ( result == 0 ) {
+    if ( length > 0 && result == 0 ) {
         eof_flag = true;
     }