link_temp_to_file: call adjust_shared_perm() only when we created the directory
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Fri, 3 Nov 2006 02:02:17 +0000 (18:02 -0800)
committerJunio C Hamano <junkio@cox.net>
Fri, 3 Nov 2006 02:02:17 +0000 (18:02 -0800)
sha1_file.c
index 5fcad2893fec7739262b06e2883ee3c261768099..27eb14b92240b2f8b99ebf10bb4a6f8c00a02e5b 100644 (file)
@@ -1382,8 +1382,7 @@ static int link_temp_to_file(const char *tmpfile, const char *filename)
        dir = strrchr(filename, '/');
        if (dir) {
                *dir = 0;
-               mkdir(filename, 0777);
-               if (adjust_shared_perm(filename)) {
+               if (!mkdir(filename, 0777) && adjust_shared_perm(filename)) {
                        *dir = '/';
                        return -2;
                }