OSDN Git Service

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 5fcad28..27eb14b 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;
                }