Added safe wrappers to creat, chown, lchown and chmod.

To prevent race conditions in path lookup when we change attributes.

Continuation of issue #3693.
Merge pull request #1140 from kacfengine/safe_stuff

Added safe wrappers to creat, chown, lchown and chmod.