checking if file system has space to write (linux only), reverting the protocol to make it compatible with 1.1.0.1, tagging AUTH as WiP, tunning the player/bot collision... preparing to release patch
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5656 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -360,9 +360,16 @@ bool stream::getline(char *str, int len)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
#include <sys/statvfs.h>
|
||||
#define MINFSSIZE 50000000 // 50MB
|
||||
#endif
|
||||
|
||||
struct filestream : stream
|
||||
{
|
||||
FILE *file;
|
||||
u_long f_frsize;
|
||||
fsblkcnt_t f_bavail;
|
||||
|
||||
filestream() : file(NULL) {}
|
||||
~filestream() { close(); }
|
||||
@@ -371,6 +378,18 @@ struct filestream : stream
|
||||
{
|
||||
if(file) return false;
|
||||
file = fopen(name, mode);
|
||||
#ifdef __linux__
|
||||
struct statvfs buf;
|
||||
if(file && strchr(mode,'w'))
|
||||
{
|
||||
int fail = fstatvfs(fileno(file), &buf);
|
||||
if (fail || buf.f_frsize * (buf.f_bavail / 1000) < MINFSSIZE)
|
||||
{
|
||||
close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return file!=NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user