From: Zoltan B. <zb...@du...> - 2006-09-13 21:51:35
|
Hi, the code in rpdf specifically opens a disk file, and read() returning 0 usually means end of file. And rpdf doesn't use O_NONBLOCK on the file it opens, so this case might be an error, e.g. someone truncated the file while you were reading it. It's best to stop reading and treat it as an error. Best regards, Zolt=E1n William K. Volkman =EDrta: > Hi, > Sorry, I should have said something earlier. The > system calls of "read" or "write" returning zero is not an > error (they return "-1", which necessitated the ssize_t type), > so the comparisons should have been ">=3D 0". In practice > it rarely happens unless you are doing network programming, > during network congestion you will frequently get a "0" > return. I didn't supply a patch however if you'd like I > can. > > HTH, > William. > > On Wed, 2006-09-13 at 13:39, Bob Doan wrote: > =20 >> Actually you can't subtract size in that routine like that because it >> will cause stuff below to fail and no images will make it to the repor= t. >> >> Attached is my version of it (committed) >> On Sun, 2006-09-10 at 11:06 +0200, Zoltan Boszormenyi wrote: >> =20 >>> the stricter compiler and function attributes >>> on Fedora Core 6 Test3 gave me warnings >>> in rpdf, which turn out to be real bugs: >>> ignored value returned by read() and write() >>> can cause incomplete picture file read-in in >>> rpdf/rpdf.c or incomplete PDF writeout >>> rpdf/test.c. Also, a static function rpdf_error() >>> isn't used anywhere, I made it inaccessible >>> to the preprocessor with #if 0 for now. >>> >>> =20 > > > > -----------------------------------------------------------------------= -- > Using Tomcat but need to do more? Need to support web services, securit= y? > Get stuff done quickly with pre-integrated technology to make your job = easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geron= imo > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > Rlib-devel mailing list > Rli...@li... > https://lists.sourceforge.net/lists/listinfo/rlib-devel > > =20 |