From: adash Date: Thu, 26 May 2011 18:07:08 +0000 (+0000) Subject: enable error checking X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=eec1b63cb26e3cc114eb2dfc8178e1e803ea59c3;p=IRC.git enable error checking Current the recovery SpamFilter version crashes when garbled characters are added to a filename when opening the file. For example: email5 becomes email5% or email5+ The error checking identifies an incorrect filename passed to it....I think there may be a bug in the BufferedReader or the FileInputStream that causes this problem and passes a wrong filename to the nativeopen(). --- diff --git a/Robust/src/Runtime/file.c b/Robust/src/Runtime/file.c index 76c7f093..46740b5c 100644 --- a/Robust/src/Runtime/file.c +++ b/Robust/src/Runtime/file.c @@ -71,7 +71,14 @@ int CALL01(___FileInputStream______nativeOpen_____AR_B, struct ArrayObject * ___ #else int length=VAR(___filename___)->___length___; char* filename= (((char *)&VAR(___filename___)->___length___)+sizeof(int)); - int fd=open(filename, O_RDONLY, 0); + int fd; + if ((fd=open(filename, O_RDONLY, 0)) < 0) { + printf(">>>\n"); + perror("open failed"); + printf("filename is %s\n", filename); + system("pwd"); + printf("<<<\n"); + } return fd; #endif } @@ -98,7 +105,9 @@ int CALL23(___FileInputStream______nativeRead____I__AR_B_I, int fd, int numBytes if (numBytes