zip: fail with correct error code if opening a directory.

This commit is contained in:
Ryan C. Gordon 2017-07-17 12:21:26 -04:00
parent e84277a1df
commit 63de092cb7
1 changed files with 1 additions and 0 deletions

View File

@ -1545,6 +1545,7 @@ static PHYSFS_Io *ZIP_openRead(void *opaque, const char *filename)
} /* if */
BAIL_IF_ERRPASS(!entry, NULL);
BAIL_IF(entry->tree.isdir, PHYSFS_ERR_NOT_A_FILE, NULL);
retval = (PHYSFS_Io *) allocator.Malloc(sizeof (PHYSFS_Io));
GOTO_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, ZIP_openRead_failed);