@matheusbsbs / matheus-bagliano / commits / 866cae0db4
Fork 0

link_temp_to_file: call adjust_shared_perm() only when we created the directory

Johannes Schindelin committed Nov 2, 2006 at 18:02 UTC 866cae0db4af936ec6f9eb6362e50db2a1a2f792
1 file changed +1 -2
sha1_file.c
+1 -2
@@ -1382,8 +1382,7 @@ static int link_temp_to_file(const char *tmpfile, const char *filename)
1382 dir = strrchr(filename, '/');
1383 if (dir) {
1384 *dir = 0;
1385 - mkdir(filename, 0777);
1386 - if (adjust_shared_perm(filename)) {
1385 + if (!mkdir(filename, 0777) && adjust_shared_perm(filename)) {
1386 *dir = '/';
1387 return -2;
1388 }