Skip to content

Commit

Permalink
Improved fsafetranslate fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AliceLR committed Feb 23, 2018
1 parent 330557f commit 3982479
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/fsafeopen.c
Expand Up @@ -335,6 +335,11 @@ int fsafetranslate(const char *path, char *newpath)
if(stat(newpath, &file_info) != 0)
ret = -FSAFE_MATCH_FAILED;
}
else
{
// Replace the failed match with the original user-supplied path
fsafetest(path, newpath);
}
#else
// on WIN32 we can't, so fail hard
ret = -FSAFE_MATCH_FAILED;
Expand All @@ -357,8 +362,6 @@ int fsafetranslate(const char *path, char *newpath)
}
else
{
// Replace the failed translation with the user-supplied path
strcpy(newpath, path);
debug("%s:%d: failed to translate %s (err %d).\n",
__FILE__, __LINE__, path, ret);
}
Expand Down

0 comments on commit 3982479

Please sign in to comment.