Fossil SCM
No longer require that the HOME directory is writable if the fossil configuration file is already there. (With some simplifications)
Commit
b4d538f8c6149decf073f001ba1953990ba1c12a
Parent
d68cd57a9dcf5aa…
2 files changed
+3
-5
+3
-5
M
src/db.c
+3
-5
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -831,23 +831,21 @@ | ||
| 831 | 831 | } |
| 832 | 832 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 833 | 833 | /* . filenames give some window systems problems and many apps problems */ |
| 834 | 834 | zDbName = mprintf("%//_fossil", zHome); |
| 835 | 835 | #else |
| 836 | - if( file_access(zHome, W_OK) ){ | |
| 837 | - fossil_fatal("home directory %s must be writeable", zHome); | |
| 838 | - } | |
| 839 | 836 | zDbName = mprintf("%s/.fossil", zHome); |
| 840 | 837 | #endif |
| 841 | 838 | if( file_size(zDbName)<1024*3 ){ |
| 839 | + if( file_access(zHome, W_OK) ){ | |
| 840 | + fossil_fatal("home directory %s must be writeable", zHome); | |
| 841 | + } | |
| 842 | 842 | db_init_database(zDbName, zConfigSchema, (char*)0); |
| 843 | 843 | } |
| 844 | -#if defined(_WIN32) || defined(__CYGWIN__) | |
| 845 | 844 | if( file_access(zDbName, W_OK) ){ |
| 846 | 845 | fossil_fatal("configuration file %s must be writeable", zDbName); |
| 847 | 846 | } |
| 848 | -#endif | |
| 849 | 847 | if( useAttach ){ |
| 850 | 848 | db_open_or_attach(zDbName, "configdb", &g.useAttach); |
| 851 | 849 | g.dbConfig = 0; |
| 852 | 850 | g.zConfigDbType = 0; |
| 853 | 851 | }else{ |
| 854 | 852 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -831,23 +831,21 @@ | |
| 831 | } |
| 832 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 833 | /* . filenames give some window systems problems and many apps problems */ |
| 834 | zDbName = mprintf("%//_fossil", zHome); |
| 835 | #else |
| 836 | if( file_access(zHome, W_OK) ){ |
| 837 | fossil_fatal("home directory %s must be writeable", zHome); |
| 838 | } |
| 839 | zDbName = mprintf("%s/.fossil", zHome); |
| 840 | #endif |
| 841 | if( file_size(zDbName)<1024*3 ){ |
| 842 | db_init_database(zDbName, zConfigSchema, (char*)0); |
| 843 | } |
| 844 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 845 | if( file_access(zDbName, W_OK) ){ |
| 846 | fossil_fatal("configuration file %s must be writeable", zDbName); |
| 847 | } |
| 848 | #endif |
| 849 | if( useAttach ){ |
| 850 | db_open_or_attach(zDbName, "configdb", &g.useAttach); |
| 851 | g.dbConfig = 0; |
| 852 | g.zConfigDbType = 0; |
| 853 | }else{ |
| 854 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -831,23 +831,21 @@ | |
| 831 | } |
| 832 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 833 | /* . filenames give some window systems problems and many apps problems */ |
| 834 | zDbName = mprintf("%//_fossil", zHome); |
| 835 | #else |
| 836 | zDbName = mprintf("%s/.fossil", zHome); |
| 837 | #endif |
| 838 | if( file_size(zDbName)<1024*3 ){ |
| 839 | if( file_access(zHome, W_OK) ){ |
| 840 | fossil_fatal("home directory %s must be writeable", zHome); |
| 841 | } |
| 842 | db_init_database(zDbName, zConfigSchema, (char*)0); |
| 843 | } |
| 844 | if( file_access(zDbName, W_OK) ){ |
| 845 | fossil_fatal("configuration file %s must be writeable", zDbName); |
| 846 | } |
| 847 | if( useAttach ){ |
| 848 | db_open_or_attach(zDbName, "configdb", &g.useAttach); |
| 849 | g.dbConfig = 0; |
| 850 | g.zConfigDbType = 0; |
| 851 | }else{ |
| 852 |
M
src/db.c
+3
-5
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -831,23 +831,21 @@ | ||
| 831 | 831 | } |
| 832 | 832 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 833 | 833 | /* . filenames give some window systems problems and many apps problems */ |
| 834 | 834 | zDbName = mprintf("%//_fossil", zHome); |
| 835 | 835 | #else |
| 836 | - if( file_access(zHome, W_OK) ){ | |
| 837 | - fossil_fatal("home directory %s must be writeable", zHome); | |
| 838 | - } | |
| 839 | 836 | zDbName = mprintf("%s/.fossil", zHome); |
| 840 | 837 | #endif |
| 841 | 838 | if( file_size(zDbName)<1024*3 ){ |
| 839 | + if( file_access(zHome, W_OK) ){ | |
| 840 | + fossil_fatal("home directory %s must be writeable", zHome); | |
| 841 | + } | |
| 842 | 842 | db_init_database(zDbName, zConfigSchema, (char*)0); |
| 843 | 843 | } |
| 844 | -#if defined(_WIN32) || defined(__CYGWIN__) | |
| 845 | 844 | if( file_access(zDbName, W_OK) ){ |
| 846 | 845 | fossil_fatal("configuration file %s must be writeable", zDbName); |
| 847 | 846 | } |
| 848 | -#endif | |
| 849 | 847 | if( useAttach ){ |
| 850 | 848 | db_open_or_attach(zDbName, "configdb", &g.useAttach); |
| 851 | 849 | g.dbConfig = 0; |
| 852 | 850 | g.zConfigDbType = 0; |
| 853 | 851 | }else{ |
| 854 | 852 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -831,23 +831,21 @@ | |
| 831 | } |
| 832 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 833 | /* . filenames give some window systems problems and many apps problems */ |
| 834 | zDbName = mprintf("%//_fossil", zHome); |
| 835 | #else |
| 836 | if( file_access(zHome, W_OK) ){ |
| 837 | fossil_fatal("home directory %s must be writeable", zHome); |
| 838 | } |
| 839 | zDbName = mprintf("%s/.fossil", zHome); |
| 840 | #endif |
| 841 | if( file_size(zDbName)<1024*3 ){ |
| 842 | db_init_database(zDbName, zConfigSchema, (char*)0); |
| 843 | } |
| 844 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 845 | if( file_access(zDbName, W_OK) ){ |
| 846 | fossil_fatal("configuration file %s must be writeable", zDbName); |
| 847 | } |
| 848 | #endif |
| 849 | if( useAttach ){ |
| 850 | db_open_or_attach(zDbName, "configdb", &g.useAttach); |
| 851 | g.dbConfig = 0; |
| 852 | g.zConfigDbType = 0; |
| 853 | }else{ |
| 854 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -831,23 +831,21 @@ | |
| 831 | } |
| 832 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 833 | /* . filenames give some window systems problems and many apps problems */ |
| 834 | zDbName = mprintf("%//_fossil", zHome); |
| 835 | #else |
| 836 | zDbName = mprintf("%s/.fossil", zHome); |
| 837 | #endif |
| 838 | if( file_size(zDbName)<1024*3 ){ |
| 839 | if( file_access(zHome, W_OK) ){ |
| 840 | fossil_fatal("home directory %s must be writeable", zHome); |
| 841 | } |
| 842 | db_init_database(zDbName, zConfigSchema, (char*)0); |
| 843 | } |
| 844 | if( file_access(zDbName, W_OK) ){ |
| 845 | fossil_fatal("configuration file %s must be writeable", zDbName); |
| 846 | } |
| 847 | if( useAttach ){ |
| 848 | db_open_or_attach(zDbName, "configdb", &g.useAttach); |
| 849 | g.dbConfig = 0; |
| 850 | g.zConfigDbType = 0; |
| 851 | }else{ |
| 852 |