Fossil SCM

Merge reduction of fossil_panic() calls, for cleaner abnormal exits.

larrybr 2021-03-31 12:42 trunk merge
Commit 31c7bdb80b81efc0e629e531da8bde6caec197a55e430ec2e9e2f8394066ea48
+3 -3
--- src/bundle.c
+++ src/bundle.c
@@ -60,11 +60,11 @@
6060
if( !doInit && file_size(zFile, ExtFILE)<0 ){
6161
fossil_fatal("no such file: %s", zFile);
6262
}
6363
assert( g.db );
6464
zSql = sqlite3_mprintf("ATTACH %Q AS %Q", zFile, zBName);
65
- if( zSql==0 ) fossil_panic("out of memory");
65
+ if( zSql==0 ) fossil_fatal("out of memory");
6666
rc = sqlite3_exec(g.db, zSql, 0, 0, &zErrMsg);
6767
sqlite3_free(zSql);
6868
if( rc!=SQLITE_OK || zErrMsg ){
6969
if( zErrMsg==0 ) zErrMsg = (char*)sqlite3_errmsg(g.db);
7070
fossil_fatal("not a valid bundle: %s", zFile);
@@ -73,18 +73,18 @@
7373
db_multi_exec(zBundleInit /*works-like:"%w%w"*/, zBName, zBName);
7474
}else{
7575
sqlite3_stmt *pStmt;
7676
zSql = sqlite3_mprintf("SELECT bcname, bcvalue"
7777
" FROM \"%w\".bconfig", zBName);
78
- if( zSql==0 ) fossil_panic("out of memory");
78
+ if( zSql==0 ) fossil_fatal("out of memory");
7979
rc = sqlite3_prepare(g.db, zSql, -1, &pStmt, 0);
8080
if( rc ) fossil_fatal("not a valid bundle: %s", zFile);
8181
sqlite3_free(zSql);
8282
sqlite3_finalize(pStmt);
8383
zSql = sqlite3_mprintf("SELECT blobid, uuid, sz, delta, notes, data"
8484
" FROM \"%w\".bblob", zBName);
85
- if( zSql==0 ) fossil_panic("out of memory");
85
+ if( zSql==0 ) fossil_fatal("out of memory");
8686
rc = sqlite3_prepare(g.db, zSql, -1, &pStmt, 0);
8787
if( rc ) fossil_fatal("not a valid bundle: %s", zFile);
8888
sqlite3_free(zSql);
8989
sqlite3_finalize(pStmt);
9090
}
9191
--- src/bundle.c
+++ src/bundle.c
@@ -60,11 +60,11 @@
60 if( !doInit && file_size(zFile, ExtFILE)<0 ){
61 fossil_fatal("no such file: %s", zFile);
62 }
63 assert( g.db );
64 zSql = sqlite3_mprintf("ATTACH %Q AS %Q", zFile, zBName);
65 if( zSql==0 ) fossil_panic("out of memory");
66 rc = sqlite3_exec(g.db, zSql, 0, 0, &zErrMsg);
67 sqlite3_free(zSql);
68 if( rc!=SQLITE_OK || zErrMsg ){
69 if( zErrMsg==0 ) zErrMsg = (char*)sqlite3_errmsg(g.db);
70 fossil_fatal("not a valid bundle: %s", zFile);
@@ -73,18 +73,18 @@
73 db_multi_exec(zBundleInit /*works-like:"%w%w"*/, zBName, zBName);
74 }else{
75 sqlite3_stmt *pStmt;
76 zSql = sqlite3_mprintf("SELECT bcname, bcvalue"
77 " FROM \"%w\".bconfig", zBName);
78 if( zSql==0 ) fossil_panic("out of memory");
79 rc = sqlite3_prepare(g.db, zSql, -1, &pStmt, 0);
80 if( rc ) fossil_fatal("not a valid bundle: %s", zFile);
81 sqlite3_free(zSql);
82 sqlite3_finalize(pStmt);
83 zSql = sqlite3_mprintf("SELECT blobid, uuid, sz, delta, notes, data"
84 " FROM \"%w\".bblob", zBName);
85 if( zSql==0 ) fossil_panic("out of memory");
86 rc = sqlite3_prepare(g.db, zSql, -1, &pStmt, 0);
87 if( rc ) fossil_fatal("not a valid bundle: %s", zFile);
88 sqlite3_free(zSql);
89 sqlite3_finalize(pStmt);
90 }
91
--- src/bundle.c
+++ src/bundle.c
@@ -60,11 +60,11 @@
60 if( !doInit && file_size(zFile, ExtFILE)<0 ){
61 fossil_fatal("no such file: %s", zFile);
62 }
63 assert( g.db );
64 zSql = sqlite3_mprintf("ATTACH %Q AS %Q", zFile, zBName);
65 if( zSql==0 ) fossil_fatal("out of memory");
66 rc = sqlite3_exec(g.db, zSql, 0, 0, &zErrMsg);
67 sqlite3_free(zSql);
68 if( rc!=SQLITE_OK || zErrMsg ){
69 if( zErrMsg==0 ) zErrMsg = (char*)sqlite3_errmsg(g.db);
70 fossil_fatal("not a valid bundle: %s", zFile);
@@ -73,18 +73,18 @@
73 db_multi_exec(zBundleInit /*works-like:"%w%w"*/, zBName, zBName);
74 }else{
75 sqlite3_stmt *pStmt;
76 zSql = sqlite3_mprintf("SELECT bcname, bcvalue"
77 " FROM \"%w\".bconfig", zBName);
78 if( zSql==0 ) fossil_fatal("out of memory");
79 rc = sqlite3_prepare(g.db, zSql, -1, &pStmt, 0);
80 if( rc ) fossil_fatal("not a valid bundle: %s", zFile);
81 sqlite3_free(zSql);
82 sqlite3_finalize(pStmt);
83 zSql = sqlite3_mprintf("SELECT blobid, uuid, sz, delta, notes, data"
84 " FROM \"%w\".bblob", zBName);
85 if( zSql==0 ) fossil_fatal("out of memory");
86 rc = sqlite3_prepare(g.db, zSql, -1, &pStmt, 0);
87 if( rc ) fossil_fatal("not a valid bundle: %s", zFile);
88 sqlite3_free(zSql);
89 sqlite3_finalize(pStmt);
90 }
91
+1 -1
--- src/cgi.c
+++ src/cgi.c
@@ -1836,11 +1836,11 @@
18361836
if( nCycles==0 ){
18371837
cgi_setenv("REMOTE_ADDR", zIpAddr);
18381838
g.zIpAddr = fossil_strdup(zIpAddr);
18391839
}
18401840
}else{
1841
- fossil_panic("missing SSH IP address");
1841
+ fossil_fatal("missing SSH IP address");
18421842
}
18431843
if( fgets(zLine, sizeof(zLine),g.httpIn)==0 ){
18441844
malformed_request("missing HTTP header");
18451845
}
18461846
cgi_trace(zLine);
18471847
--- src/cgi.c
+++ src/cgi.c
@@ -1836,11 +1836,11 @@
1836 if( nCycles==0 ){
1837 cgi_setenv("REMOTE_ADDR", zIpAddr);
1838 g.zIpAddr = fossil_strdup(zIpAddr);
1839 }
1840 }else{
1841 fossil_panic("missing SSH IP address");
1842 }
1843 if( fgets(zLine, sizeof(zLine),g.httpIn)==0 ){
1844 malformed_request("missing HTTP header");
1845 }
1846 cgi_trace(zLine);
1847
--- src/cgi.c
+++ src/cgi.c
@@ -1836,11 +1836,11 @@
1836 if( nCycles==0 ){
1837 cgi_setenv("REMOTE_ADDR", zIpAddr);
1838 g.zIpAddr = fossil_strdup(zIpAddr);
1839 }
1840 }else{
1841 fossil_fatal("missing SSH IP address");
1842 }
1843 if( fgets(zLine, sizeof(zLine),g.httpIn)==0 ){
1844 malformed_request("missing HTTP header");
1845 }
1846 cgi_trace(zLine);
1847
+5 -5
--- src/db.c
+++ src/db.c
@@ -456,16 +456,16 @@
456456
}
457457
db.protectMask = db.aProtect[--db.nProtect];
458458
}
459459
460460
/*
461
-** Verify that the desired database write pertections are in place.
461
+** Verify that the desired database write protections are in place.
462462
** Throw a fatal error if not.
463463
*/
464464
void db_assert_protected(unsigned flags){
465465
if( (flags & db.protectMask)!=flags ){
466
- fossil_panic("missing database write protection bits: %02x",
466
+ fossil_fatal("missing database write protection bits: %02x",
467467
flags & ~db.protectMask);
468468
}
469469
}
470470
471471
/*
@@ -1834,11 +1834,11 @@
18341834
18351835
/* The HOME variable is required in order to continue.
18361836
*/
18371837
if( zHome==0 ){
18381838
if( isOptional ) return 0;
1839
- fossil_panic("cannot locate home directory - please set one of the "
1839
+ fossil_fatal("cannot locate home directory - please set one of the "
18401840
"FOSSIL_HOME, XDG_CONFIG_HOME, or HOME environment "
18411841
"variables");
18421842
}
18431843
18441844
/* Step 4: If $HOME/.config is a directory -> $HOME/.config/fossil.db
@@ -1884,17 +1884,17 @@
18841884
}
18851885
rc = file_access(zHome, W_OK);
18861886
fossil_free(zHome);
18871887
if( rc ){
18881888
if( isOptional ) return 0;
1889
- fossil_panic("home directory \"%s\" must be writeable", zHome);
1889
+ fossil_fatal("home directory \"%s\" must be writeable", zHome);
18901890
}
18911891
db_init_database(zDbName, zConfigSchema, (char*)0);
18921892
}
18931893
if( file_access(zDbName, W_OK) ){
18941894
if( isOptional ) return 0;
1895
- fossil_panic("configuration file %s must be writeable", zDbName);
1895
+ fossil_fatal("configuration file %s must be writeable", zDbName);
18961896
}
18971897
if( useAttach ){
18981898
db_open_or_attach(zDbName, "configdb");
18991899
g.dbConfig = 0;
19001900
}else{
19011901
--- src/db.c
+++ src/db.c
@@ -456,16 +456,16 @@
456 }
457 db.protectMask = db.aProtect[--db.nProtect];
458 }
459
460 /*
461 ** Verify that the desired database write pertections are in place.
462 ** Throw a fatal error if not.
463 */
464 void db_assert_protected(unsigned flags){
465 if( (flags & db.protectMask)!=flags ){
466 fossil_panic("missing database write protection bits: %02x",
467 flags & ~db.protectMask);
468 }
469 }
470
471 /*
@@ -1834,11 +1834,11 @@
1834
1835 /* The HOME variable is required in order to continue.
1836 */
1837 if( zHome==0 ){
1838 if( isOptional ) return 0;
1839 fossil_panic("cannot locate home directory - please set one of the "
1840 "FOSSIL_HOME, XDG_CONFIG_HOME, or HOME environment "
1841 "variables");
1842 }
1843
1844 /* Step 4: If $HOME/.config is a directory -> $HOME/.config/fossil.db
@@ -1884,17 +1884,17 @@
1884 }
1885 rc = file_access(zHome, W_OK);
1886 fossil_free(zHome);
1887 if( rc ){
1888 if( isOptional ) return 0;
1889 fossil_panic("home directory \"%s\" must be writeable", zHome);
1890 }
1891 db_init_database(zDbName, zConfigSchema, (char*)0);
1892 }
1893 if( file_access(zDbName, W_OK) ){
1894 if( isOptional ) return 0;
1895 fossil_panic("configuration file %s must be writeable", zDbName);
1896 }
1897 if( useAttach ){
1898 db_open_or_attach(zDbName, "configdb");
1899 g.dbConfig = 0;
1900 }else{
1901
--- src/db.c
+++ src/db.c
@@ -456,16 +456,16 @@
456 }
457 db.protectMask = db.aProtect[--db.nProtect];
458 }
459
460 /*
461 ** Verify that the desired database write protections are in place.
462 ** Throw a fatal error if not.
463 */
464 void db_assert_protected(unsigned flags){
465 if( (flags & db.protectMask)!=flags ){
466 fossil_fatal("missing database write protection bits: %02x",
467 flags & ~db.protectMask);
468 }
469 }
470
471 /*
@@ -1834,11 +1834,11 @@
1834
1835 /* The HOME variable is required in order to continue.
1836 */
1837 if( zHome==0 ){
1838 if( isOptional ) return 0;
1839 fossil_fatal("cannot locate home directory - please set one of the "
1840 "FOSSIL_HOME, XDG_CONFIG_HOME, or HOME environment "
1841 "variables");
1842 }
1843
1844 /* Step 4: If $HOME/.config is a directory -> $HOME/.config/fossil.db
@@ -1884,17 +1884,17 @@
1884 }
1885 rc = file_access(zHome, W_OK);
1886 fossil_free(zHome);
1887 if( rc ){
1888 if( isOptional ) return 0;
1889 fossil_fatal("home directory \"%s\" must be writeable", zHome);
1890 }
1891 db_init_database(zDbName, zConfigSchema, (char*)0);
1892 }
1893 if( file_access(zDbName, W_OK) ){
1894 if( isOptional ) return 0;
1895 fossil_fatal("configuration file %s must be writeable", zDbName);
1896 }
1897 if( useAttach ){
1898 db_open_or_attach(zDbName, "configdb");
1899 g.dbConfig = 0;
1900 }else{
1901
+5 -5
--- src/file.c
+++ src/file.c
@@ -386,14 +386,14 @@
386386
** and return non-zero. If everything is ok, return zero.
387387
*/
388388
int file_unsafe_in_tree_path(const char *zFile){
389389
int n;
390390
if( !file_is_absolute_path(zFile) ){
391
- fossil_panic("%s is not an absolute pathname",zFile);
391
+ fossil_fatal("%s is not an absolute pathname",zFile);
392392
}
393393
if( fossil_strnicmp(g.zLocalRoot, zFile, (int)strlen(g.zLocalRoot)) ){
394
- fossil_panic("%s is not a prefix of %s", g.zLocalRoot, zFile);
394
+ fossil_fatal("%s is not a prefix of %s", g.zLocalRoot, zFile);
395395
}
396396
n = file_nondir_objects_on_path(g.zLocalRoot, zFile);
397397
if( n ){
398398
fossil_warning("cannot write to %s because non-directory object %.*s"
399399
" is in the way", zFile, n, zFile);
@@ -1148,13 +1148,13 @@
11481148
#ifdef _WIN32
11491149
win32_getcwd(zBuf, nBuf);
11501150
#else
11511151
if( getcwd(zBuf, nBuf-1)==0 ){
11521152
if( errno==ERANGE ){
1153
- fossil_panic("pwd too big: max %d", nBuf-1);
1153
+ fossil_fatal("pwd too big: max %d", nBuf-1);
11541154
}else{
1155
- fossil_panic("cannot find current working directory; %s",
1155
+ fossil_fatal("cannot find current working directory; %s",
11561156
strerror(errno));
11571157
}
11581158
}
11591159
#endif
11601160
return zBuf==zTemp ? fossil_strdup(zBuf) : zBuf;
@@ -1823,11 +1823,11 @@
18231823
nBasis = 6;
18241824
zBasis = "fossil";
18251825
}
18261826
do{
18271827
blob_zero(pBuf);
1828
- if( cnt++>20 ) fossil_panic("cannot generate a temporary filename");
1828
+ if( cnt++>20 ) fossil_fatal("cannot generate a temporary filename");
18291829
if( zTag==0 ){
18301830
sqlite3_randomness(15, zRand);
18311831
for(i=0; i<15; i++){
18321832
zRand[i] = (char)zChars[ ((unsigned char)zRand[i])%(sizeof(zChars)-1) ];
18331833
}
18341834
--- src/file.c
+++ src/file.c
@@ -386,14 +386,14 @@
386 ** and return non-zero. If everything is ok, return zero.
387 */
388 int file_unsafe_in_tree_path(const char *zFile){
389 int n;
390 if( !file_is_absolute_path(zFile) ){
391 fossil_panic("%s is not an absolute pathname",zFile);
392 }
393 if( fossil_strnicmp(g.zLocalRoot, zFile, (int)strlen(g.zLocalRoot)) ){
394 fossil_panic("%s is not a prefix of %s", g.zLocalRoot, zFile);
395 }
396 n = file_nondir_objects_on_path(g.zLocalRoot, zFile);
397 if( n ){
398 fossil_warning("cannot write to %s because non-directory object %.*s"
399 " is in the way", zFile, n, zFile);
@@ -1148,13 +1148,13 @@
1148 #ifdef _WIN32
1149 win32_getcwd(zBuf, nBuf);
1150 #else
1151 if( getcwd(zBuf, nBuf-1)==0 ){
1152 if( errno==ERANGE ){
1153 fossil_panic("pwd too big: max %d", nBuf-1);
1154 }else{
1155 fossil_panic("cannot find current working directory; %s",
1156 strerror(errno));
1157 }
1158 }
1159 #endif
1160 return zBuf==zTemp ? fossil_strdup(zBuf) : zBuf;
@@ -1823,11 +1823,11 @@
1823 nBasis = 6;
1824 zBasis = "fossil";
1825 }
1826 do{
1827 blob_zero(pBuf);
1828 if( cnt++>20 ) fossil_panic("cannot generate a temporary filename");
1829 if( zTag==0 ){
1830 sqlite3_randomness(15, zRand);
1831 for(i=0; i<15; i++){
1832 zRand[i] = (char)zChars[ ((unsigned char)zRand[i])%(sizeof(zChars)-1) ];
1833 }
1834
--- src/file.c
+++ src/file.c
@@ -386,14 +386,14 @@
386 ** and return non-zero. If everything is ok, return zero.
387 */
388 int file_unsafe_in_tree_path(const char *zFile){
389 int n;
390 if( !file_is_absolute_path(zFile) ){
391 fossil_fatal("%s is not an absolute pathname",zFile);
392 }
393 if( fossil_strnicmp(g.zLocalRoot, zFile, (int)strlen(g.zLocalRoot)) ){
394 fossil_fatal("%s is not a prefix of %s", g.zLocalRoot, zFile);
395 }
396 n = file_nondir_objects_on_path(g.zLocalRoot, zFile);
397 if( n ){
398 fossil_warning("cannot write to %s because non-directory object %.*s"
399 " is in the way", zFile, n, zFile);
@@ -1148,13 +1148,13 @@
1148 #ifdef _WIN32
1149 win32_getcwd(zBuf, nBuf);
1150 #else
1151 if( getcwd(zBuf, nBuf-1)==0 ){
1152 if( errno==ERANGE ){
1153 fossil_fatal("pwd too big: max %d", nBuf-1);
1154 }else{
1155 fossil_fatal("cannot find current working directory; %s",
1156 strerror(errno));
1157 }
1158 }
1159 #endif
1160 return zBuf==zTemp ? fossil_strdup(zBuf) : zBuf;
@@ -1823,11 +1823,11 @@
1823 nBasis = 6;
1824 zBasis = "fossil";
1825 }
1826 do{
1827 blob_zero(pBuf);
1828 if( cnt++>20 ) fossil_fatal("cannot generate a temporary filename");
1829 if( zTag==0 ){
1830 sqlite3_randomness(15, zRand);
1831 for(i=0; i<15; i++){
1832 zRand[i] = (char)zChars[ ((unsigned char)zRand[i])%(sizeof(zChars)-1) ];
1833 }
1834
+3 -3
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -116,11 +116,11 @@
116116
X509_STORE_set_default_paths(SSL_CTX_get_cert_store(sslCtx));
117117
}else{
118118
/* User has specified a CA location, make sure it exists and use it */
119119
switch( file_isdir(zCaSetting, ExtFILE) ){
120120
case 0: { /* doesn't exist */
121
- fossil_panic("ssl-ca-location is set to '%s', "
121
+ fossil_fatal("ssl-ca-location is set to '%s', "
122122
"but is not a file or directory", zCaSetting);
123123
break;
124124
}
125125
case 1: { /* directory */
126126
zCaDirectory = zCaSetting;
@@ -130,11 +130,11 @@
130130
zCaFile = zCaSetting;
131131
break;
132132
}
133133
}
134134
if( SSL_CTX_load_verify_locations(sslCtx, zCaFile, zCaDirectory)==0 ){
135
- fossil_panic("Failed to use CA root certificates from "
135
+ fossil_fatal("Failed to use CA root certificates from "
136136
"ssl-ca-location '%s'", zCaSetting);
137137
}
138138
}
139139
140140
/* Load client SSL identity, preferring the filename specified on the
@@ -146,11 +146,11 @@
146146
}
147147
if( identityFile!=0 && identityFile[0]!='\0' ){
148148
if( SSL_CTX_use_certificate_file(sslCtx,identityFile,SSL_FILETYPE_PEM)!=1
149149
|| SSL_CTX_use_PrivateKey_file(sslCtx,identityFile,SSL_FILETYPE_PEM)!=1
150150
){
151
- fossil_panic("Could not load SSL identity from %s", identityFile);
151
+ fossil_fatal("Could not load SSL identity from %s", identityFile);
152152
}
153153
}
154154
/* Register a callback to tell the user what to do when the server asks
155155
** for a cert */
156156
SSL_CTX_set_client_cert_cb(sslCtx, ssl_client_cert_callback);
157157
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -116,11 +116,11 @@
116 X509_STORE_set_default_paths(SSL_CTX_get_cert_store(sslCtx));
117 }else{
118 /* User has specified a CA location, make sure it exists and use it */
119 switch( file_isdir(zCaSetting, ExtFILE) ){
120 case 0: { /* doesn't exist */
121 fossil_panic("ssl-ca-location is set to '%s', "
122 "but is not a file or directory", zCaSetting);
123 break;
124 }
125 case 1: { /* directory */
126 zCaDirectory = zCaSetting;
@@ -130,11 +130,11 @@
130 zCaFile = zCaSetting;
131 break;
132 }
133 }
134 if( SSL_CTX_load_verify_locations(sslCtx, zCaFile, zCaDirectory)==0 ){
135 fossil_panic("Failed to use CA root certificates from "
136 "ssl-ca-location '%s'", zCaSetting);
137 }
138 }
139
140 /* Load client SSL identity, preferring the filename specified on the
@@ -146,11 +146,11 @@
146 }
147 if( identityFile!=0 && identityFile[0]!='\0' ){
148 if( SSL_CTX_use_certificate_file(sslCtx,identityFile,SSL_FILETYPE_PEM)!=1
149 || SSL_CTX_use_PrivateKey_file(sslCtx,identityFile,SSL_FILETYPE_PEM)!=1
150 ){
151 fossil_panic("Could not load SSL identity from %s", identityFile);
152 }
153 }
154 /* Register a callback to tell the user what to do when the server asks
155 ** for a cert */
156 SSL_CTX_set_client_cert_cb(sslCtx, ssl_client_cert_callback);
157
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -116,11 +116,11 @@
116 X509_STORE_set_default_paths(SSL_CTX_get_cert_store(sslCtx));
117 }else{
118 /* User has specified a CA location, make sure it exists and use it */
119 switch( file_isdir(zCaSetting, ExtFILE) ){
120 case 0: { /* doesn't exist */
121 fossil_fatal("ssl-ca-location is set to '%s', "
122 "but is not a file or directory", zCaSetting);
123 break;
124 }
125 case 1: { /* directory */
126 zCaDirectory = zCaSetting;
@@ -130,11 +130,11 @@
130 zCaFile = zCaSetting;
131 break;
132 }
133 }
134 if( SSL_CTX_load_verify_locations(sslCtx, zCaFile, zCaDirectory)==0 ){
135 fossil_fatal("Failed to use CA root certificates from "
136 "ssl-ca-location '%s'", zCaSetting);
137 }
138 }
139
140 /* Load client SSL identity, preferring the filename specified on the
@@ -146,11 +146,11 @@
146 }
147 if( identityFile!=0 && identityFile[0]!='\0' ){
148 if( SSL_CTX_use_certificate_file(sslCtx,identityFile,SSL_FILETYPE_PEM)!=1
149 || SSL_CTX_use_PrivateKey_file(sslCtx,identityFile,SSL_FILETYPE_PEM)!=1
150 ){
151 fossil_fatal("Could not load SSL identity from %s", identityFile);
152 }
153 }
154 /* Register a callback to tell the user what to do when the server asks
155 ** for a cert */
156 SSL_CTX_set_client_cert_cb(sslCtx, ssl_client_cert_callback);
157
--- src/http_transport.c
+++ src/http_transport.c
@@ -127,19 +127,19 @@
127127
fossil_free(zHost);
128128
}else{
129129
blob_append_escaped_arg(&zCmd, pUrlData->name);
130130
}
131131
if( !is_safe_fossil_command(pUrlData->fossil) ){
132
- fossil_panic("the ssh:// URL is asking to run an unsafe command [%s] on "
132
+ fossil_fatal("the ssh:// URL is asking to run an unsafe command [%s] on "
133133
"the server.", pUrlData->fossil);
134134
}
135135
blob_append_escaped_arg(&zCmd, pUrlData->fossil);
136136
blob_append(&zCmd, " test-http", 10);
137137
if( pUrlData->path && pUrlData->path[0] ){
138138
blob_append_escaped_arg(&zCmd, pUrlData->path);
139139
}else{
140
- fossil_panic("ssh:// URI does not specify a path to the repository");
140
+ fossil_fatal("ssh:// URI does not specify a path to the repository");
141141
}
142142
if( g.fSshTrace ){
143143
fossil_print("%s\n", blob_str(&zCmd)); /* Show the whole SSH command */
144144
}
145145
popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid, 0);
@@ -181,11 +181,11 @@
181181
g.zRepositoryName, iRandId);
182182
transport.zInFile = mprintf("%s-%llu-in.http",
183183
g.zRepositoryName, iRandId);
184184
transport.pFile = fossil_fopen(transport.zOutFile, "wb");
185185
if( transport.pFile==0 ){
186
- fossil_panic("cannot output temporary file: %s", transport.zOutFile);
186
+ fossil_fatal("cannot output temporary file: %s", transport.zOutFile);
187187
}
188188
transport.isOpen = 1;
189189
}else{
190190
rc = socket_open(pUrlData);
191191
if( rc==0 ) transport.isOpen = 1;
192192
--- src/http_transport.c
+++ src/http_transport.c
@@ -127,19 +127,19 @@
127 fossil_free(zHost);
128 }else{
129 blob_append_escaped_arg(&zCmd, pUrlData->name);
130 }
131 if( !is_safe_fossil_command(pUrlData->fossil) ){
132 fossil_panic("the ssh:// URL is asking to run an unsafe command [%s] on "
133 "the server.", pUrlData->fossil);
134 }
135 blob_append_escaped_arg(&zCmd, pUrlData->fossil);
136 blob_append(&zCmd, " test-http", 10);
137 if( pUrlData->path && pUrlData->path[0] ){
138 blob_append_escaped_arg(&zCmd, pUrlData->path);
139 }else{
140 fossil_panic("ssh:// URI does not specify a path to the repository");
141 }
142 if( g.fSshTrace ){
143 fossil_print("%s\n", blob_str(&zCmd)); /* Show the whole SSH command */
144 }
145 popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid, 0);
@@ -181,11 +181,11 @@
181 g.zRepositoryName, iRandId);
182 transport.zInFile = mprintf("%s-%llu-in.http",
183 g.zRepositoryName, iRandId);
184 transport.pFile = fossil_fopen(transport.zOutFile, "wb");
185 if( transport.pFile==0 ){
186 fossil_panic("cannot output temporary file: %s", transport.zOutFile);
187 }
188 transport.isOpen = 1;
189 }else{
190 rc = socket_open(pUrlData);
191 if( rc==0 ) transport.isOpen = 1;
192
--- src/http_transport.c
+++ src/http_transport.c
@@ -127,19 +127,19 @@
127 fossil_free(zHost);
128 }else{
129 blob_append_escaped_arg(&zCmd, pUrlData->name);
130 }
131 if( !is_safe_fossil_command(pUrlData->fossil) ){
132 fossil_fatal("the ssh:// URL is asking to run an unsafe command [%s] on "
133 "the server.", pUrlData->fossil);
134 }
135 blob_append_escaped_arg(&zCmd, pUrlData->fossil);
136 blob_append(&zCmd, " test-http", 10);
137 if( pUrlData->path && pUrlData->path[0] ){
138 blob_append_escaped_arg(&zCmd, pUrlData->path);
139 }else{
140 fossil_fatal("ssh:// URI does not specify a path to the repository");
141 }
142 if( g.fSshTrace ){
143 fossil_print("%s\n", blob_str(&zCmd)); /* Show the whole SSH command */
144 }
145 popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid, 0);
@@ -181,11 +181,11 @@
181 g.zRepositoryName, iRandId);
182 transport.zInFile = mprintf("%s-%llu-in.http",
183 g.zRepositoryName, iRandId);
184 transport.pFile = fossil_fopen(transport.zOutFile, "wb");
185 if( transport.pFile==0 ){
186 fossil_fatal("cannot output temporary file: %s", transport.zOutFile);
187 }
188 transport.isOpen = 1;
189 }else{
190 rc = socket_open(pUrlData);
191 if( rc==0 ) transport.isOpen = 1;
192
+1 -1
--- src/import.c
+++ src/import.c
@@ -636,11 +636,11 @@
636636
if( gg.nData ){
637637
int got;
638638
gg.aData = fossil_malloc( gg.nData+1 );
639639
got = fread(gg.aData, 1, gg.nData, pIn);
640640
if( got!=gg.nData ){
641
- fossil_panic("short read: got %d of %d bytes", got, gg.nData);
641
+ fossil_fatal("short read: got %d of %d bytes", got, gg.nData);
642642
}
643643
gg.aData[got] = '\0';
644644
if( gg.zComment==0 &&
645645
(gg.xFinish==finish_commit || gg.xFinish==finish_tag) ){
646646
/* Strip trailing newline, it's appended to the comment. */
647647
--- src/import.c
+++ src/import.c
@@ -636,11 +636,11 @@
636 if( gg.nData ){
637 int got;
638 gg.aData = fossil_malloc( gg.nData+1 );
639 got = fread(gg.aData, 1, gg.nData, pIn);
640 if( got!=gg.nData ){
641 fossil_panic("short read: got %d of %d bytes", got, gg.nData);
642 }
643 gg.aData[got] = '\0';
644 if( gg.zComment==0 &&
645 (gg.xFinish==finish_commit || gg.xFinish==finish_tag) ){
646 /* Strip trailing newline, it's appended to the comment. */
647
--- src/import.c
+++ src/import.c
@@ -636,11 +636,11 @@
636 if( gg.nData ){
637 int got;
638 gg.aData = fossil_malloc( gg.nData+1 );
639 got = fread(gg.aData, 1, gg.nData, pIn);
640 if( got!=gg.nData ){
641 fossil_fatal("short read: got %d of %d bytes", got, gg.nData);
642 }
643 gg.aData[got] = '\0';
644 if( gg.zComment==0 &&
645 (gg.xFinish==finish_commit || gg.xFinish==finish_tag) ){
646 /* Strip trailing newline, it's appended to the comment. */
647
--- src/json_status.c
+++ src/json_status.c
@@ -167,11 +167,11 @@
167167
blob_append(report, zPrefix, nPrefix);
168168
blob_appendf(report, "%s %s\n", zLabel, db_column_text(&q, 0));
169169
}
170170
db_finalize(&q);
171171
if( nErr ){
172
- fossil_panic("aborting due to prior errors");
172
+ fossil_fatal("aborting due to prior errors");
173173
}
174174
#endif
175175
return cson_object_value( oPay );
176176
}
177177
178178
--- src/json_status.c
+++ src/json_status.c
@@ -167,11 +167,11 @@
167 blob_append(report, zPrefix, nPrefix);
168 blob_appendf(report, "%s %s\n", zLabel, db_column_text(&q, 0));
169 }
170 db_finalize(&q);
171 if( nErr ){
172 fossil_panic("aborting due to prior errors");
173 }
174 #endif
175 return cson_object_value( oPay );
176 }
177
178
--- src/json_status.c
+++ src/json_status.c
@@ -167,11 +167,11 @@
167 blob_append(report, zPrefix, nPrefix);
168 blob_appendf(report, "%s %s\n", zLabel, db_column_text(&q, 0));
169 }
170 db_finalize(&q);
171 if( nErr ){
172 fossil_fatal("aborting due to prior errors");
173 }
174 #endif
175 return cson_object_value( oPay );
176 }
177
178
+2 -2
--- src/main.c
+++ src/main.c
@@ -1468,15 +1468,15 @@
14681468
}
14691469
g.fJail = 1;
14701470
zRepo = "/";
14711471
}else{
14721472
for(i=strlen(zDir)-1; i>0 && zDir[i]!='/'; i--){}
1473
- if( zDir[i]!='/' ) fossil_panic("bad repository name: %s", zRepo);
1473
+ if( zDir[i]!='/' ) fossil_fatal("bad repository name: %s", zRepo);
14741474
if( i>0 ){
14751475
zDir[i] = 0;
14761476
if( file_chdir(zDir, 1) ){
1477
- fossil_panic("unable to chroot into %s", zDir);
1477
+ fossil_fatal("unable to chroot into %s", zDir);
14781478
}
14791479
zDir[i] = '/';
14801480
}
14811481
zRepo = &zDir[i];
14821482
}
14831483
--- src/main.c
+++ src/main.c
@@ -1468,15 +1468,15 @@
1468 }
1469 g.fJail = 1;
1470 zRepo = "/";
1471 }else{
1472 for(i=strlen(zDir)-1; i>0 && zDir[i]!='/'; i--){}
1473 if( zDir[i]!='/' ) fossil_panic("bad repository name: %s", zRepo);
1474 if( i>0 ){
1475 zDir[i] = 0;
1476 if( file_chdir(zDir, 1) ){
1477 fossil_panic("unable to chroot into %s", zDir);
1478 }
1479 zDir[i] = '/';
1480 }
1481 zRepo = &zDir[i];
1482 }
1483
--- src/main.c
+++ src/main.c
@@ -1468,15 +1468,15 @@
1468 }
1469 g.fJail = 1;
1470 zRepo = "/";
1471 }else{
1472 for(i=strlen(zDir)-1; i>0 && zDir[i]!='/'; i--){}
1473 if( zDir[i]!='/' ) fossil_fatal("bad repository name: %s", zRepo);
1474 if( i>0 ){
1475 zDir[i] = 0;
1476 if( file_chdir(zDir, 1) ){
1477 fossil_fatal("unable to chroot into %s", zDir);
1478 }
1479 zDir[i] = '/';
1480 }
1481 zRepo = &zDir[i];
1482 }
1483
+12 -6
--- src/printf.c
+++ src/printf.c
@@ -1132,23 +1132,29 @@
11321132
return rc;
11331133
}
11341134
11351135
/*
11361136
** Print an error message, rollback all databases, and quit. These
1137
-** routines never return.
1137
+** routines never return and produce a non-zero process exit status.
11381138
**
1139
-** The only different between fossil_fatal() and fossil_panic() is that
1139
+** The main difference between fossil_fatal() and fossil_panic() is that
11401140
** fossil_panic() makes an entry in the error log whereas fossil_fatal()
1141
-** does not. If there is not error log, then both routines work the
1142
-** same. Hence, the routines are interchangable for commands and only
1143
-** make a difference with processing web pages.
1141
+** does not. On POSIX platforms, if there is not an error log, then both
1142
+** routines work similarly with respect to user-visible effects. Hence,
1143
+** the routines are interchangable for commands and only act differently
1144
+** when processing web pages. On the Windows platform, fossil_panic()
1145
+** also displays a pop-up stating that an error has occured and allowing
1146
+** just-in-time debugging to commence. On all platforms, fossil_panic()
1147
+** ends execution with a SIGABRT signal, bypassing atexit processing.
1148
+** This signal can also produce a core dump on POSIX platforms.
11441149
**
11451150
** Use fossil_fatal() for malformed inputs that should be reported back
11461151
** to the user, but which do not represent a configuration problem or bug.
11471152
**
11481153
** Use fossil_panic() for any kind of error that should be brought to the
1149
-** attention of the system administrator.
1154
+** attention of the system administrator or Fossil developers. It should
1155
+** be avoided for ordinary usage, parameter, OOM and I/O errors.
11501156
*/
11511157
NORETURN void fossil_panic(const char *zFormat, ...){
11521158
va_list ap;
11531159
int rc = 1;
11541160
char z[1000];
11551161
--- src/printf.c
+++ src/printf.c
@@ -1132,23 +1132,29 @@
1132 return rc;
1133 }
1134
1135 /*
1136 ** Print an error message, rollback all databases, and quit. These
1137 ** routines never return.
1138 **
1139 ** The only different between fossil_fatal() and fossil_panic() is that
1140 ** fossil_panic() makes an entry in the error log whereas fossil_fatal()
1141 ** does not. If there is not error log, then both routines work the
1142 ** same. Hence, the routines are interchangable for commands and only
1143 ** make a difference with processing web pages.
 
 
 
 
 
1144 **
1145 ** Use fossil_fatal() for malformed inputs that should be reported back
1146 ** to the user, but which do not represent a configuration problem or bug.
1147 **
1148 ** Use fossil_panic() for any kind of error that should be brought to the
1149 ** attention of the system administrator.
 
1150 */
1151 NORETURN void fossil_panic(const char *zFormat, ...){
1152 va_list ap;
1153 int rc = 1;
1154 char z[1000];
1155
--- src/printf.c
+++ src/printf.c
@@ -1132,23 +1132,29 @@
1132 return rc;
1133 }
1134
1135 /*
1136 ** Print an error message, rollback all databases, and quit. These
1137 ** routines never return and produce a non-zero process exit status.
1138 **
1139 ** The main difference between fossil_fatal() and fossil_panic() is that
1140 ** fossil_panic() makes an entry in the error log whereas fossil_fatal()
1141 ** does not. On POSIX platforms, if there is not an error log, then both
1142 ** routines work similarly with respect to user-visible effects. Hence,
1143 ** the routines are interchangable for commands and only act differently
1144 ** when processing web pages. On the Windows platform, fossil_panic()
1145 ** also displays a pop-up stating that an error has occured and allowing
1146 ** just-in-time debugging to commence. On all platforms, fossil_panic()
1147 ** ends execution with a SIGABRT signal, bypassing atexit processing.
1148 ** This signal can also produce a core dump on POSIX platforms.
1149 **
1150 ** Use fossil_fatal() for malformed inputs that should be reported back
1151 ** to the user, but which do not represent a configuration problem or bug.
1152 **
1153 ** Use fossil_panic() for any kind of error that should be brought to the
1154 ** attention of the system administrator or Fossil developers. It should
1155 ** be avoided for ordinary usage, parameter, OOM and I/O errors.
1156 */
1157 NORETURN void fossil_panic(const char *zFormat, ...){
1158 va_list ap;
1159 int rc = 1;
1160 char z[1000];
1161
+1 -1
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -303,11 +303,11 @@
303303
*pnKey = (int)strlen(zKey);
304304
}else{
305305
*pnKey = -1;
306306
}
307307
}else{
308
- fossil_panic("failed to allocate %u bytes for key", nByte);
308
+ fossil_fatal("failed to allocate %u bytes for key", nByte);
309309
}
310310
}
311311
#endif
312312
313313
/*
314314
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -303,11 +303,11 @@
303 *pnKey = (int)strlen(zKey);
304 }else{
305 *pnKey = -1;
306 }
307 }else{
308 fossil_panic("failed to allocate %u bytes for key", nByte);
309 }
310 }
311 #endif
312
313 /*
314
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -303,11 +303,11 @@
303 *pnKey = (int)strlen(zKey);
304 }else{
305 *pnKey = -1;
306 }
307 }else{
308 fossil_fatal("failed to allocate %u bytes for key", nByte);
309 }
310 }
311 #endif
312
313 /*
314
+1 -1
--- src/undo.c
+++ src/undo.c
@@ -269,11 +269,11 @@
269269
** tree.
270270
*/
271271
void undo_save(const char *zPathname){
272272
if( undoDisable ) return;
273273
if( undo_maybe_save(zPathname, -1)!=UNDO_SAVED_OK ){
274
- fossil_panic("failed to save undo information for path: %s",
274
+ fossil_fatal("failed to save undo information for path: %s",
275275
zPathname);
276276
}
277277
}
278278
279279
/*
280280
--- src/undo.c
+++ src/undo.c
@@ -269,11 +269,11 @@
269 ** tree.
270 */
271 void undo_save(const char *zPathname){
272 if( undoDisable ) return;
273 if( undo_maybe_save(zPathname, -1)!=UNDO_SAVED_OK ){
274 fossil_panic("failed to save undo information for path: %s",
275 zPathname);
276 }
277 }
278
279 /*
280
--- src/undo.c
+++ src/undo.c
@@ -269,11 +269,11 @@
269 ** tree.
270 */
271 void undo_save(const char *zPathname){
272 if( undoDisable ) return;
273 if( undo_maybe_save(zPathname, -1)!=UNDO_SAVED_OK ){
274 fossil_fatal("failed to save undo information for path: %s",
275 zPathname);
276 }
277 }
278
279 /*
280
+7 -7
--- src/util.c
+++ src/util.c
@@ -56,25 +56,25 @@
5656
/*
5757
** Malloc and free routines that cannot fail
5858
*/
5959
void *fossil_malloc(size_t n){
6060
void *p = malloc(n==0 ? 1 : n);
61
- if( p==0 ) fossil_panic("out of memory");
61
+ if( p==0 ) fossil_fatal("out of memory");
6262
return p;
6363
}
6464
void *fossil_malloc_zero(size_t n){
6565
void *p = malloc(n==0 ? 1 : n);
66
- if( p==0 ) fossil_panic("out of memory");
66
+ if( p==0 ) fossil_fatal("out of memory");
6767
memset(p, 0, n);
6868
return p;
6969
}
7070
void fossil_free(void *p){
7171
free(p);
7272
}
7373
void *fossil_realloc(void *p, size_t n){
7474
p = realloc(p, n);
75
- if( p==0 ) fossil_panic("out of memory");
75
+ if( p==0 ) fossil_fatal("out of memory");
7676
return p;
7777
}
7878
void fossil_secure_zero(void *p, size_t n){
7979
volatile unsigned char *vp = (volatile unsigned char *)p;
8080
size_t i;
@@ -105,22 +105,22 @@
105105
assert( pageSize>0 );
106106
assert( pageSize%2==0 );
107107
#if defined(_WIN32)
108108
p = VirtualAlloc(NULL, pageSize, MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE);
109109
if( p==NULL ){
110
- fossil_panic("VirtualAlloc failed: %lu\n", GetLastError());
110
+ fossil_fatal("VirtualAlloc failed: %lu\n", GetLastError());
111111
}
112112
if( !VirtualLock(p, pageSize) ){
113
- fossil_panic("VirtualLock failed: %lu\n", GetLastError());
113
+ fossil_fatal("VirtualLock failed: %lu\n", GetLastError());
114114
}
115115
#elif defined(USE_MMAN_H)
116116
p = mmap(0, pageSize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
117117
if( p==MAP_FAILED ){
118
- fossil_panic("mmap failed: %d\n", errno);
118
+ fossil_fatal("mmap failed: %d\n", errno);
119119
}
120120
if( mlock(p, pageSize) ){
121
- fossil_panic("mlock failed: %d\n", errno);
121
+ fossil_fatal("mlock failed: %d\n", errno);
122122
}
123123
#else
124124
p = fossil_malloc(pageSize);
125125
#endif
126126
fossil_secure_zero(p, pageSize);
127127
--- src/util.c
+++ src/util.c
@@ -56,25 +56,25 @@
56 /*
57 ** Malloc and free routines that cannot fail
58 */
59 void *fossil_malloc(size_t n){
60 void *p = malloc(n==0 ? 1 : n);
61 if( p==0 ) fossil_panic("out of memory");
62 return p;
63 }
64 void *fossil_malloc_zero(size_t n){
65 void *p = malloc(n==0 ? 1 : n);
66 if( p==0 ) fossil_panic("out of memory");
67 memset(p, 0, n);
68 return p;
69 }
70 void fossil_free(void *p){
71 free(p);
72 }
73 void *fossil_realloc(void *p, size_t n){
74 p = realloc(p, n);
75 if( p==0 ) fossil_panic("out of memory");
76 return p;
77 }
78 void fossil_secure_zero(void *p, size_t n){
79 volatile unsigned char *vp = (volatile unsigned char *)p;
80 size_t i;
@@ -105,22 +105,22 @@
105 assert( pageSize>0 );
106 assert( pageSize%2==0 );
107 #if defined(_WIN32)
108 p = VirtualAlloc(NULL, pageSize, MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE);
109 if( p==NULL ){
110 fossil_panic("VirtualAlloc failed: %lu\n", GetLastError());
111 }
112 if( !VirtualLock(p, pageSize) ){
113 fossil_panic("VirtualLock failed: %lu\n", GetLastError());
114 }
115 #elif defined(USE_MMAN_H)
116 p = mmap(0, pageSize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
117 if( p==MAP_FAILED ){
118 fossil_panic("mmap failed: %d\n", errno);
119 }
120 if( mlock(p, pageSize) ){
121 fossil_panic("mlock failed: %d\n", errno);
122 }
123 #else
124 p = fossil_malloc(pageSize);
125 #endif
126 fossil_secure_zero(p, pageSize);
127
--- src/util.c
+++ src/util.c
@@ -56,25 +56,25 @@
56 /*
57 ** Malloc and free routines that cannot fail
58 */
59 void *fossil_malloc(size_t n){
60 void *p = malloc(n==0 ? 1 : n);
61 if( p==0 ) fossil_fatal("out of memory");
62 return p;
63 }
64 void *fossil_malloc_zero(size_t n){
65 void *p = malloc(n==0 ? 1 : n);
66 if( p==0 ) fossil_fatal("out of memory");
67 memset(p, 0, n);
68 return p;
69 }
70 void fossil_free(void *p){
71 free(p);
72 }
73 void *fossil_realloc(void *p, size_t n){
74 p = realloc(p, n);
75 if( p==0 ) fossil_fatal("out of memory");
76 return p;
77 }
78 void fossil_secure_zero(void *p, size_t n){
79 volatile unsigned char *vp = (volatile unsigned char *)p;
80 size_t i;
@@ -105,22 +105,22 @@
105 assert( pageSize>0 );
106 assert( pageSize%2==0 );
107 #if defined(_WIN32)
108 p = VirtualAlloc(NULL, pageSize, MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE);
109 if( p==NULL ){
110 fossil_fatal("VirtualAlloc failed: %lu\n", GetLastError());
111 }
112 if( !VirtualLock(p, pageSize) ){
113 fossil_fatal("VirtualLock failed: %lu\n", GetLastError());
114 }
115 #elif defined(USE_MMAN_H)
116 p = mmap(0, pageSize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
117 if( p==MAP_FAILED ){
118 fossil_fatal("mmap failed: %d\n", errno);
119 }
120 if( mlock(p, pageSize) ){
121 fossil_fatal("mlock failed: %d\n", errno);
122 }
123 #else
124 p = fossil_malloc(pageSize);
125 #endif
126 fossil_secure_zero(p, pageSize);
127
+1 -1
--- src/winfile.c
+++ src/winfile.c
@@ -282,11 +282,11 @@
282282
void win32_getcwd(char *zBuf, int nBuf){
283283
int i;
284284
char *zUtf8;
285285
wchar_t *zWide = fossil_malloc( sizeof(wchar_t)*nBuf );
286286
if( GetCurrentDirectoryW(nBuf, zWide)==0 ){
287
- fossil_panic("cannot find current working directory.");
287
+ fossil_fatal("cannot find current working directory.");
288288
}
289289
zUtf8 = fossil_path_to_utf8(zWide);
290290
fossil_free(zWide);
291291
for(i=0; zUtf8[i]; i++) if( zUtf8[i]=='\\' ) zUtf8[i] = '/';
292292
strncpy(zBuf, zUtf8, nBuf);
293293
--- src/winfile.c
+++ src/winfile.c
@@ -282,11 +282,11 @@
282 void win32_getcwd(char *zBuf, int nBuf){
283 int i;
284 char *zUtf8;
285 wchar_t *zWide = fossil_malloc( sizeof(wchar_t)*nBuf );
286 if( GetCurrentDirectoryW(nBuf, zWide)==0 ){
287 fossil_panic("cannot find current working directory.");
288 }
289 zUtf8 = fossil_path_to_utf8(zWide);
290 fossil_free(zWide);
291 for(i=0; zUtf8[i]; i++) if( zUtf8[i]=='\\' ) zUtf8[i] = '/';
292 strncpy(zBuf, zUtf8, nBuf);
293
--- src/winfile.c
+++ src/winfile.c
@@ -282,11 +282,11 @@
282 void win32_getcwd(char *zBuf, int nBuf){
283 int i;
284 char *zUtf8;
285 wchar_t *zWide = fossil_malloc( sizeof(wchar_t)*nBuf );
286 if( GetCurrentDirectoryW(nBuf, zWide)==0 ){
287 fossil_fatal("cannot find current working directory.");
288 }
289 zUtf8 = fossil_path_to_utf8(zWide);
290 fossil_free(zWide);
291 for(i=0; zUtf8[i]; i++) if( zUtf8[i]=='\\' ) zUtf8[i] = '/';
292 strncpy(zBuf, zUtf8, nBuf);
293
+5 -4
--- src/winhttp.c
+++ src/winhttp.c
@@ -288,11 +288,11 @@
288288
static NORETURN void winhttp_fatal(
289289
const char *zOp,
290290
const char *zService,
291291
const char *zErr
292292
){
293
- fossil_panic("unable to %s service '%s': %s", zOp, zService, zErr);
293
+ fossil_fatal("unable to %s service '%s': %s", zOp, zService, zErr);
294294
}
295295
296296
/*
297297
** Make sure the server stops as soon as possible after the stopper file
298298
** is found. If there is no stopper file name, do nothing.
@@ -604,14 +604,15 @@
604604
}
605605
}
606606
break;
607607
}
608608
if( iPort>mxPort ){
609
+ /* These exits are merely fatal because firewall settings can cause them. */
609610
if( mnPort==mxPort ){
610
- fossil_panic("unable to open listening socket on port %d", mnPort);
611
+ fossil_fatal("unable to open listening socket on port %d", mnPort);
611612
}else{
612
- fossil_panic("unable to open listening socket on any"
613
+ fossil_fatal("unable to open listening socket on any"
613614
" port in the range %d..%d", mnPort, mxPort);
614615
}
615616
}
616617
if( !GetTempPathW(MAX_PATH, zTmpPath) ){
617618
fossil_panic("unable to get path to the temporary directory.");
@@ -908,11 +909,11 @@
908909
/* Try to start the control dispatcher thread for the service. */
909910
if( !StartServiceCtrlDispatcherW(ServiceTable) ){
910911
if( GetLastError()==ERROR_FAILED_SERVICE_CONTROLLER_CONNECT ){
911912
return 1;
912913
}else{
913
- fossil_panic("error from StartServiceCtrlDispatcher()");
914
+ fossil_fatal("error from StartServiceCtrlDispatcher()");
914915
}
915916
}
916917
return 0;
917918
}
918919
919920
--- src/winhttp.c
+++ src/winhttp.c
@@ -288,11 +288,11 @@
288 static NORETURN void winhttp_fatal(
289 const char *zOp,
290 const char *zService,
291 const char *zErr
292 ){
293 fossil_panic("unable to %s service '%s': %s", zOp, zService, zErr);
294 }
295
296 /*
297 ** Make sure the server stops as soon as possible after the stopper file
298 ** is found. If there is no stopper file name, do nothing.
@@ -604,14 +604,15 @@
604 }
605 }
606 break;
607 }
608 if( iPort>mxPort ){
 
609 if( mnPort==mxPort ){
610 fossil_panic("unable to open listening socket on port %d", mnPort);
611 }else{
612 fossil_panic("unable to open listening socket on any"
613 " port in the range %d..%d", mnPort, mxPort);
614 }
615 }
616 if( !GetTempPathW(MAX_PATH, zTmpPath) ){
617 fossil_panic("unable to get path to the temporary directory.");
@@ -908,11 +909,11 @@
908 /* Try to start the control dispatcher thread for the service. */
909 if( !StartServiceCtrlDispatcherW(ServiceTable) ){
910 if( GetLastError()==ERROR_FAILED_SERVICE_CONTROLLER_CONNECT ){
911 return 1;
912 }else{
913 fossil_panic("error from StartServiceCtrlDispatcher()");
914 }
915 }
916 return 0;
917 }
918
919
--- src/winhttp.c
+++ src/winhttp.c
@@ -288,11 +288,11 @@
288 static NORETURN void winhttp_fatal(
289 const char *zOp,
290 const char *zService,
291 const char *zErr
292 ){
293 fossil_fatal("unable to %s service '%s': %s", zOp, zService, zErr);
294 }
295
296 /*
297 ** Make sure the server stops as soon as possible after the stopper file
298 ** is found. If there is no stopper file name, do nothing.
@@ -604,14 +604,15 @@
604 }
605 }
606 break;
607 }
608 if( iPort>mxPort ){
609 /* These exits are merely fatal because firewall settings can cause them. */
610 if( mnPort==mxPort ){
611 fossil_fatal("unable to open listening socket on port %d", mnPort);
612 }else{
613 fossil_fatal("unable to open listening socket on any"
614 " port in the range %d..%d", mnPort, mxPort);
615 }
616 }
617 if( !GetTempPathW(MAX_PATH, zTmpPath) ){
618 fossil_panic("unable to get path to the temporary directory.");
@@ -908,11 +909,11 @@
909 /* Try to start the control dispatcher thread for the service. */
910 if( !StartServiceCtrlDispatcherW(ServiceTable) ){
911 if( GetLastError()==ERROR_FAILED_SERVICE_CONTROLLER_CONNECT ){
912 return 1;
913 }else{
914 fossil_fatal("error from StartServiceCtrlDispatcher()");
915 }
916 }
917 return 0;
918 }
919
920

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button