From a65d8e1de995241719acb01faa74cd6f4e80848e Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Wed, 5 May 2004 19:37:01 +0000 Subject: [PATCH] added some doc git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@1533 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- util-vserver/lib_internal/unify-unify.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util-vserver/lib_internal/unify-unify.c b/util-vserver/lib_internal/unify-unify.c index 7270532..a3d6a18 100644 --- a/util-vserver/lib_internal/unify-unify.c +++ b/util-vserver/lib_internal/unify-unify.c @@ -57,6 +57,10 @@ Unify_unify(char const *src, struct stat const UNUSED *src_stat, } // and rename the old file to this name + + // NOTE: this rename() is race-free; when an attacker makes 'tmpfile' a + // directory, the operation would fail; when making it a symlink to a file + // or directory, the symlink but not the file/directory would be overridden if (rename(dst, tmpfile)==-1) { perror("rename()"); goto err; -- 1.8.1.5