Skip to content
Snippets Groups Projects
Commit 93f4f04b authored by rswindell's avatar rswindell
Browse files

Work-around observed infinite loop trying to print a 0-byte file where

feof() was returning 0 and fgets() never returned NULL. Weird.
parent 8a3d8d2c
No related branches found
No related tags found
No related merge requests found
...@@ -96,11 +96,14 @@ bool sbbs_t::printfile(const char* fname, long mode, long org_cols) ...@@ -96,11 +96,14 @@ bool sbbs_t::printfile(const char* fname, long mode, long org_cols)
} }
length=(long)filelength(file); length=(long)filelength(file);
if(length<0) { if(length < 1) {
fclose(stream); fclose(stream);
if(length < 0) {
errormsg(WHERE,ERR_CHK,fpath,length); errormsg(WHERE,ERR_CHK,fpath,length);
return false; return false;
} }
return true;
}
if(mode&P_OPENCLOSE) { if(mode&P_OPENCLOSE) {
if((buf=(char*)malloc(length+1L))==NULL) { if((buf=(char*)malloc(length+1L))==NULL) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment