Fossil SCM
Attempt to fix repolist so that it works even if the global configuration database is not available, for example when Fossil is being run inside a chroot jail with a restricted environment.
Commit
e761c1d6f75d2eee9eaee79ad0c0f381bb4aecc686986dda8cb92382b4da8163
Parent
8dd05c52f5fac7a…
1 file changed
+8
-5
+8
-5
| --- src/repolist.c | ||
| +++ src/repolist.c | ||
| @@ -145,15 +145,18 @@ | ||
| 145 | 145 | char *zSkinUrl = 0; /* URL for the skin database */ |
| 146 | 146 | int bShowDesc = 0; /* True to show the description column */ |
| 147 | 147 | int bShowLg = 0; /* True to show the login-group column */ |
| 148 | 148 | |
| 149 | 149 | assert( g.db==0 ); |
| 150 | - db_open_config(1, 0); | |
| 151 | - bShowDesc = (0!=db_int(0, "SELECT value FROM global_config" | |
| 152 | - " WHERE name='show-repolist-desc'")); | |
| 153 | - bShowLg = (0!=db_int(0, "SELECT value FROM global_config" | |
| 154 | - " WHERE name='show-repolist-lg'")); | |
| 150 | + if( db_open_config(1, 1) | |
| 151 | + && db_table_exists("configdb", "global_config") | |
| 152 | + ){ | |
| 153 | + bShowDesc = (0!=db_int(0, "SELECT value FROM global_config" | |
| 154 | + " WHERE name='show-repolist-desc'")); | |
| 155 | + bShowLg = (0!=db_int(0, "SELECT value FROM global_config" | |
| 156 | + " WHERE name='show-repolist-lg'")); | |
| 157 | + } | |
| 155 | 158 | blob_init(&html, 0, 0); |
| 156 | 159 | if( fossil_strcmp(g.zRepositoryName,"/")==0 && !g.fJail ){ |
| 157 | 160 | /* For the special case of the "repository directory" being "/", |
| 158 | 161 | ** show all of the repositories named in the ~/.fossil database. |
| 159 | 162 | ** |
| 160 | 163 |
| --- src/repolist.c | |
| +++ src/repolist.c | |
| @@ -145,15 +145,18 @@ | |
| 145 | char *zSkinUrl = 0; /* URL for the skin database */ |
| 146 | int bShowDesc = 0; /* True to show the description column */ |
| 147 | int bShowLg = 0; /* True to show the login-group column */ |
| 148 | |
| 149 | assert( g.db==0 ); |
| 150 | db_open_config(1, 0); |
| 151 | bShowDesc = (0!=db_int(0, "SELECT value FROM global_config" |
| 152 | " WHERE name='show-repolist-desc'")); |
| 153 | bShowLg = (0!=db_int(0, "SELECT value FROM global_config" |
| 154 | " WHERE name='show-repolist-lg'")); |
| 155 | blob_init(&html, 0, 0); |
| 156 | if( fossil_strcmp(g.zRepositoryName,"/")==0 && !g.fJail ){ |
| 157 | /* For the special case of the "repository directory" being "/", |
| 158 | ** show all of the repositories named in the ~/.fossil database. |
| 159 | ** |
| 160 |
| --- src/repolist.c | |
| +++ src/repolist.c | |
| @@ -145,15 +145,18 @@ | |
| 145 | char *zSkinUrl = 0; /* URL for the skin database */ |
| 146 | int bShowDesc = 0; /* True to show the description column */ |
| 147 | int bShowLg = 0; /* True to show the login-group column */ |
| 148 | |
| 149 | assert( g.db==0 ); |
| 150 | if( db_open_config(1, 1) |
| 151 | && db_table_exists("configdb", "global_config") |
| 152 | ){ |
| 153 | bShowDesc = (0!=db_int(0, "SELECT value FROM global_config" |
| 154 | " WHERE name='show-repolist-desc'")); |
| 155 | bShowLg = (0!=db_int(0, "SELECT value FROM global_config" |
| 156 | " WHERE name='show-repolist-lg'")); |
| 157 | } |
| 158 | blob_init(&html, 0, 0); |
| 159 | if( fossil_strcmp(g.zRepositoryName,"/")==0 && !g.fJail ){ |
| 160 | /* For the special case of the "repository directory" being "/", |
| 161 | ** show all of the repositories named in the ~/.fossil database. |
| 162 | ** |
| 163 |