Merged logic from windows to posix
Authored by: fweispfenning 2013-01-11
Parent: [r289]
Child: [r291]