[sword-cvs] sword/src/mgr filemgr.cpp,1.36,1.37
sword@www.crosswire.org
sword@www.crosswire.org
Sat, 17 Jan 2004 16:12:48 -0700
- Previous message: [sword-cvs] sword/debian libsword3.conffiles,1.1,NONE libsword3.dirs,1.1,NONE libsword3.docs,1.1,NONE libsword3.shlibs,1.1,NONE
- Next message: [sword-cvs] swordreader/src SwRd.vco,1.4,1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/core/sword/src/mgr
In directory www:/tmp/cvs-serv22544/src/mgr
Modified Files:
filemgr.cpp
Log Message:
Added assert for valid/readable file
Index: filemgr.cpp
===================================================================
RCS file: /cvs/core/sword/src/mgr/filemgr.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- filemgr.cpp 17 Jan 2004 18:38:06 -0000 1.36
+++ filemgr.cpp 17 Jan 2004 23:12:46 -0000 1.37
@@ -365,6 +365,11 @@
bool more = true;
line = "";
+
+ // assert we have a valid file handle
+ if (fDesc->getFd() < 1)
+ return 0;
+
while (more) {
more = false;
long index = lseek(fDesc->getFd(), 0, SEEK_CUR);
@@ -375,6 +380,9 @@
else index++;
}
+ // assert we have a readable file (not a directory)
+ if (len < 0)
+ break;
while (ch != 10) {
if ((len = read(fDesc->getFd(), &ch, 1)) != 1)
@@ -405,7 +413,7 @@
line += buf;
delete [] buf;
}
- return (len || line.length());
+ return ((len>0) || line.length());
}
- Previous message: [sword-cvs] sword/debian libsword3.conffiles,1.1,NONE libsword3.dirs,1.1,NONE libsword3.docs,1.1,NONE libsword3.shlibs,1.1,NONE
- Next message: [sword-cvs] swordreader/src SwRd.vco,1.4,1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]