Fossil SCM
Fix for Cygwin ACL bug
Commit
4043d5ea0b767c10ee6007eae013b170d9802b2c
Parent
1afb9f7d9f41965…
1 file changed
+3
-4
+3
-4
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -247,12 +247,11 @@ | ||
| 247 | 247 | if( S_ISREG(fileStat.st_mode) && ((S_IXUSR)&fileStat.st_mode)!=0 ) |
| 248 | 248 | return PERM_EXE; |
| 249 | 249 | else |
| 250 | 250 | return PERM_REG; |
| 251 | 251 | #else |
| 252 | - if( S_ISREG(fileStat.st_mode) && | |
| 253 | - ((S_IXUSR|S_IXGRP|S_IXOTH)&fileStat.st_mode)!=0 ) | |
| 252 | + if( S_ISREG(fileStat.st_mode) && ((S_IXUSR)&fileStat.st_mode)!=0 ) | |
| 254 | 253 | return PERM_EXE; |
| 255 | 254 | else if( g.allowSymlinks && S_ISLNK(fileStat.st_mode) ) |
| 256 | 255 | return PERM_LNK; |
| 257 | 256 | else |
| 258 | 257 | return PERM_REG; |
| @@ -432,16 +431,16 @@ | ||
| 432 | 431 | #if !defined(_WIN32) |
| 433 | 432 | struct stat buf; |
| 434 | 433 | if( fossil_stat(zFilename, &buf, 1)!=0 || S_ISLNK(buf.st_mode) ) return 0; |
| 435 | 434 | if( onoff ){ |
| 436 | 435 | int targetMode = (buf.st_mode & 0444)>>2; |
| 437 | - if( (buf.st_mode & 0111)!=targetMode ){ | |
| 436 | + if( (buf.st_mode & 0100) == 0 ){ | |
| 438 | 437 | chmod(zFilename, buf.st_mode | targetMode); |
| 439 | 438 | rc = 1; |
| 440 | 439 | } |
| 441 | 440 | }else{ |
| 442 | - if( (buf.st_mode & 0111)!=0 ){ | |
| 441 | + if( (buf.st_mode & 0100) != 0 ){ | |
| 443 | 442 | chmod(zFilename, buf.st_mode & ~0111); |
| 444 | 443 | rc = 1; |
| 445 | 444 | } |
| 446 | 445 | } |
| 447 | 446 | #endif /* _WIN32 */ |
| 448 | 447 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -247,12 +247,11 @@ | |
| 247 | if( S_ISREG(fileStat.st_mode) && ((S_IXUSR)&fileStat.st_mode)!=0 ) |
| 248 | return PERM_EXE; |
| 249 | else |
| 250 | return PERM_REG; |
| 251 | #else |
| 252 | if( S_ISREG(fileStat.st_mode) && |
| 253 | ((S_IXUSR|S_IXGRP|S_IXOTH)&fileStat.st_mode)!=0 ) |
| 254 | return PERM_EXE; |
| 255 | else if( g.allowSymlinks && S_ISLNK(fileStat.st_mode) ) |
| 256 | return PERM_LNK; |
| 257 | else |
| 258 | return PERM_REG; |
| @@ -432,16 +431,16 @@ | |
| 432 | #if !defined(_WIN32) |
| 433 | struct stat buf; |
| 434 | if( fossil_stat(zFilename, &buf, 1)!=0 || S_ISLNK(buf.st_mode) ) return 0; |
| 435 | if( onoff ){ |
| 436 | int targetMode = (buf.st_mode & 0444)>>2; |
| 437 | if( (buf.st_mode & 0111)!=targetMode ){ |
| 438 | chmod(zFilename, buf.st_mode | targetMode); |
| 439 | rc = 1; |
| 440 | } |
| 441 | }else{ |
| 442 | if( (buf.st_mode & 0111)!=0 ){ |
| 443 | chmod(zFilename, buf.st_mode & ~0111); |
| 444 | rc = 1; |
| 445 | } |
| 446 | } |
| 447 | #endif /* _WIN32 */ |
| 448 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -247,12 +247,11 @@ | |
| 247 | if( S_ISREG(fileStat.st_mode) && ((S_IXUSR)&fileStat.st_mode)!=0 ) |
| 248 | return PERM_EXE; |
| 249 | else |
| 250 | return PERM_REG; |
| 251 | #else |
| 252 | if( S_ISREG(fileStat.st_mode) && ((S_IXUSR)&fileStat.st_mode)!=0 ) |
| 253 | return PERM_EXE; |
| 254 | else if( g.allowSymlinks && S_ISLNK(fileStat.st_mode) ) |
| 255 | return PERM_LNK; |
| 256 | else |
| 257 | return PERM_REG; |
| @@ -432,16 +431,16 @@ | |
| 431 | #if !defined(_WIN32) |
| 432 | struct stat buf; |
| 433 | if( fossil_stat(zFilename, &buf, 1)!=0 || S_ISLNK(buf.st_mode) ) return 0; |
| 434 | if( onoff ){ |
| 435 | int targetMode = (buf.st_mode & 0444)>>2; |
| 436 | if( (buf.st_mode & 0100) == 0 ){ |
| 437 | chmod(zFilename, buf.st_mode | targetMode); |
| 438 | rc = 1; |
| 439 | } |
| 440 | }else{ |
| 441 | if( (buf.st_mode & 0100) != 0 ){ |
| 442 | chmod(zFilename, buf.st_mode & ~0111); |
| 443 | rc = 1; |
| 444 | } |
| 445 | } |
| 446 | #endif /* _WIN32 */ |
| 447 |