[3.5.x] Added safe wrappers to creat, chown, lchown and chmod.

To prevent race conditions in path lookup when we change attributes.

Continuation of issue #3693.
(cherry picked from commit 8e9b258aaead20584c18709932cf3bd3b7613712)

Conflicts:

	libcompat/fstatat.c
	libcompat/openat.c
	libpromises/files_copy.c