Make safe_open() treat trailing slashes like open().
Merge pull request #1330 from kacfengine/ending_slashes

[Redmine #3905] Make safe_open() treat trailing slashes like open().