Pass a FD to resise_file and add a testcase.

I will add a real use in another commit.