deal with no-file-name case when using C's tmpfile()