File tree Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -1331,31 +1331,29 @@ char *write_sha1_file_prepare(void *buf,
1331
1331
static int link_temp_to_file (const char * tmpfile , char * filename )
1332
1332
{
1333
1333
int ret ;
1334
+ char * dir ;
1334
1335
1335
1336
if (!link (tmpfile , filename ))
1336
1337
return 0 ;
1337
1338
1338
1339
/*
1339
- * Try to mkdir the last path component if that failed
1340
- * with an ENOENT.
1340
+ * Try to mkdir the last path component if that failed.
1341
1341
*
1342
1342
* Re-try the "link()" regardless of whether the mkdir
1343
1343
* succeeds, since a race might mean that somebody
1344
1344
* else succeeded.
1345
1345
*/
1346
1346
ret = errno ;
1347
- if (ret == ENOENT ) {
1348
- char * dir = strrchr (filename , '/' );
1349
- if (dir ) {
1350
- * dir = 0 ;
1351
- mkdir (filename , 0777 );
1352
- if (adjust_shared_perm (filename ))
1353
- return -2 ;
1354
- * dir = '/' ;
1355
- if (!link (tmpfile , filename ))
1356
- return 0 ;
1357
- ret = errno ;
1358
- }
1347
+ dir = strrchr (filename , '/' );
1348
+ if (dir ) {
1349
+ * dir = 0 ;
1350
+ mkdir (filename , 0777 );
1351
+ if (adjust_shared_perm (filename ))
1352
+ return -2 ;
1353
+ * dir = '/' ;
1354
+ if (!link (tmpfile , filename ))
1355
+ return 0 ;
1356
+ ret = errno ;
1359
1357
}
1360
1358
return ret ;
1361
1359
}
You can’t perform that action at this time.
0 commit comments