PHYSFS_mkdir() fixes.

Ryan C. Gordon icculus at
Wed Mar 19 01:17:11 EST 2003

The latest CVS of physfs has some important mkdir fixes.

First, this case would fail:

   If you have a write dir of /home/user/mygame" and wanted
to create "data/savegames/" under that when neither exist,

   PHYSFS_mkdir("/data/savegames");  would fail, because the security
verifier would throw up when it saw "data" didn't exist. This isn't
actually a security violation, but a convenient place to optimize; why
keep looking for security violations in pathnames that don't exist?

The problem is that mkdir won't create those paths in the first place
until the security verifier approves it. Now we can tell the verifier to
ignore missing paths and just keep checking for things like ".." and such.

This case failed, too, if "data" already existed, since the platform
drivers's "mkdir" implementation considers it an error to create a dir
that already exists, so PHYSFS_mkdir() would fail without creating the
"savegames" dir. Now we check if the path element exists (and is a dir!)
before trying to create it, and skip to the next path element if it's
already kosher.

Anyone using physfs is encouraged to upgrade if they use PHYSFS_mkdir().


More information about the physfs mailing list