Fossil SCM
Better error message when a CGI configuration specifies a non-existant or unreadable repository.
Commit
69650f2963ebabb601f7c0f5dbaa114819358e6a
Parent
e06ae9f6d23a627…
1 file changed
+8
-1
M
src/db.c
+8
-1
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -659,11 +659,18 @@ | ||
| 659 | 659 | if( zDbName==0 ){ |
| 660 | 660 | db_err("unable to find the name of a repository database"); |
| 661 | 661 | } |
| 662 | 662 | } |
| 663 | 663 | if( access(zDbName, R_OK) || file_size(zDbName)<1024 ){ |
| 664 | - fossil_panic("no such repository: %s", zDbName); | |
| 664 | + if( access(zDbName, 0) ){ | |
| 665 | + fossil_panic("repository does not exists or" | |
| 666 | + " is in an unreadable directory: %s", zDbName); | |
| 667 | + }else if( access(zDbName, R_OK) ){ | |
| 668 | + fossil_panic("read permission denied for repository %s", zDbName); | |
| 669 | + }else{ | |
| 670 | + fossil_panic("not a valid repository: %s", zDbName); | |
| 671 | + } | |
| 665 | 672 | } |
| 666 | 673 | db_open_or_attach(zDbName, "repository"); |
| 667 | 674 | g.repositoryOpen = 1; |
| 668 | 675 | g.zRepositoryName = mprintf("%s", zDbName); |
| 669 | 676 | } |
| 670 | 677 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -659,11 +659,18 @@ | |
| 659 | if( zDbName==0 ){ |
| 660 | db_err("unable to find the name of a repository database"); |
| 661 | } |
| 662 | } |
| 663 | if( access(zDbName, R_OK) || file_size(zDbName)<1024 ){ |
| 664 | fossil_panic("no such repository: %s", zDbName); |
| 665 | } |
| 666 | db_open_or_attach(zDbName, "repository"); |
| 667 | g.repositoryOpen = 1; |
| 668 | g.zRepositoryName = mprintf("%s", zDbName); |
| 669 | } |
| 670 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -659,11 +659,18 @@ | |
| 659 | if( zDbName==0 ){ |
| 660 | db_err("unable to find the name of a repository database"); |
| 661 | } |
| 662 | } |
| 663 | if( access(zDbName, R_OK) || file_size(zDbName)<1024 ){ |
| 664 | if( access(zDbName, 0) ){ |
| 665 | fossil_panic("repository does not exists or" |
| 666 | " is in an unreadable directory: %s", zDbName); |
| 667 | }else if( access(zDbName, R_OK) ){ |
| 668 | fossil_panic("read permission denied for repository %s", zDbName); |
| 669 | }else{ |
| 670 | fossil_panic("not a valid repository: %s", zDbName); |
| 671 | } |
| 672 | } |
| 673 | db_open_or_attach(zDbName, "repository"); |
| 674 | g.repositoryOpen = 1; |
| 675 | g.zRepositoryName = mprintf("%s", zDbName); |
| 676 | } |
| 677 |