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

Keep Deuce from killing Vert by viewing 16GB log files:

Don't use P_OPENCLOSE printfile() mode for any files > 2MB in size.
parent ef02128f
No related branches found
No related tags found
No related merge requests found
...@@ -42,6 +42,9 @@ ...@@ -42,6 +42,9 @@
#ifndef PRINTFILE_MAX_LINE_LEN #ifndef PRINTFILE_MAX_LINE_LEN
#define PRINTFILE_MAX_LINE_LEN (1024*1024) #define PRINTFILE_MAX_LINE_LEN (1024*1024)
#endif #endif
#ifndef PRINTFILE_MAX_FILE_LEN
#define PRINTFILE_MAX_FILE_LEN (1024*1024*2)
#endif
/****************************************************************************/ /****************************************************************************/
/* Prints a file remotely and locally, interpreting ^A sequences, checks */ /* Prints a file remotely and locally, interpreting ^A sequences, checks */
...@@ -105,7 +108,7 @@ bool sbbs_t::printfile(const char* fname, long mode, long org_cols, JSObject* ob ...@@ -105,7 +108,7 @@ bool sbbs_t::printfile(const char* fname, long mode, long org_cols, JSObject* ob
return true; return true;
} }
if(mode&P_OPENCLOSE) { if((mode&P_OPENCLOSE) && length <= PRINTFILE_MAX_FILE_LEN) {
if((buf=(char*)malloc(length+1L))==NULL) { if((buf=(char*)malloc(length+1L))==NULL) {
fclose(stream); fclose(stream);
errormsg(WHERE,ERR_ALLOC,fpath,length+1L); errormsg(WHERE,ERR_ALLOC,fpath,length+1L);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment