105a106
> #include <sys/statvfs.h>
111c112
< #define VERSION     "1.0.1"
---
> #define VERSION     "1.0.1 (Honeynor Patch)"
142a144
> static unsigned long int disk_limit;
156a159
> static char *lastfile;
229a233,265
> /**
>  * free_space
>  * Returns the number of bytes available on the disk device
>  * containing the specified path.
>  */
> static unsigned long long int free_space(const char *const path) {
> 
> 	struct statvfs fiData;
>     char fnPath[128];
> 	unsigned long long int blocksize, freeblocks, freespace;
> 	strcpy(fnPath,path);
> 	if((statvfs(fnPath,&fiData)) < 0 ) {
> 		return -1; 
> 	}
> 	blocksize  = fiData.f_bsize;
> 	freeblocks = fiData.f_bfree;
> 	freespace  = freeblocks * blocksize;
> 	return freespace;
> }
> 
> /**
>  * fsize
>  * Get the size (in bytes) of the given file.
>  */
> static unsigned long long int fsize(const char *const name) {
> 
> 	struct stat stbuf;
> 	if(stat(name, &stbuf) == -1)
> 		return -1;
> 	return stbuf.st_size;
> }
> 
> 
478a515,516
> 	lastfile = filepath;
> 
705a744,763
> 	unsigned long long int size_last_file, size_free;
> 
> 	if(disk_limit > 0) {
> 		/* User has set the -x option. Lets do the check before */
> 		/* a new log file is created. */
>  		size_last_file = fsize(lastfile);
> 		if ( logpath == NULL )
> 			logpath = ".";
> 		size_free = free_space(logpath);
> 		if ( ( size_free / 1024 ) - ( size_last_file / 1024 ) <= ( disk_limit * 1024 ) ) {
> 			msg("Free space limit reached!");
> 			if( ringbuffer == 0 ) {
> 				quitter(1);
>             	return ERROR;
> 			}
> 			else {	
> 				prune_oldest_file();		
> 			}
> 		}
> 	}
957a1016
>     printf("        -x <Mbytes>     Free space limit in MiB.\n");
972c1031
<             "c:df:Fg:hi:l:m:n:o:p:P:rR:s:S:t:T:u:v"))!=-1)
---
>             "c:df:Fg:hi:x:l:m:n:o:p:P:rR:s:S:t:T:u:v"))!=-1)
1009a1069,1074
> 			case 'x':
> 				if(!isdigit(optarg[0]))
>                     fatal("Bad free space limit \"%s\"\n", optarg);
> 				disk_limit = atoi(optarg);
>                 printf("[-] Free space limit set to %lu MiB\n", disk_limit);
>                 break;

