Merge pull request #1127 from kacfengine/3.5.x

[3.5.x] Fixes for HP-UX.
Fix broken safe_open() when path contains double slashes.
(cherry picked from commit ed36f31a54950a2778f380a9c3606502120ba647)