implemented ftruncate() call so bash redirection can work