]> git.mxchange.org Git - simgear.git/blobdiff - simgear/io/sg_file.cxx
- new FSF addresses
[simgear.git] / simgear / io / sg_file.cxx
index 079fefec7283dd90c54c12d991605ad7a915f050..0505cac46679a24403536829481de70a735154df 100644 (file)
@@ -16,7 +16,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
@@ -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;
     }