work around magic_buffer()/magic_file() returning null with no error set