Bugfixes and refactoring of SIGXFSZ signal handler

Few small bugs and code refactoring to check_file_size() and SIGXFSZ signal handler.