lavf/libssh: factorize file_stat function