Fossil SCM

Make sure the zOrigName variable in the /doc page implementation is always initialized, even for early errors.

drh 2015-01-23 13:50 trunk
Commit f5165dd05bb99f6c68594e0e197ec37ae9db5598
1 file changed +2 -2
+2 -2
--- src/doc.c
+++ src/doc.c
@@ -399,21 +399,21 @@
399399
}else{
400400
zName += i;
401401
}
402402
while( zName[0]=='/' ){ zName++; }
403403
g.zPath = mprintf("%s/%s/%s", g.zPath, zCheckin, zName);
404
+ zOrigName = zName;
404405
if( !file_is_simple_pathname(zName, 1) ){
405406
if( sqlite3_strglob("*/", zName)==0 ){
406
- zName = mprintf("%sindex.wiki", zName);
407
+ zOrigName = zName = mprintf("%sindex.wiki", zName);
407408
if( !file_is_simple_pathname(zName, 1) ){
408409
goto doc_not_found;
409410
}
410411
}else{
411412
goto doc_not_found;
412413
}
413414
}
414
- zOrigName = zName;
415415
if( fossil_strcmp(zCheckin,"ckout")==0 && db_open_local(0)==0 ){
416416
sqlite3_snprintf(sizeof(zCheckin), zCheckin, "tip");
417417
}
418418
if( fossil_strcmp(zCheckin,"ckout")==0 ){
419419
/* Read from the local checkout */
420420
--- src/doc.c
+++ src/doc.c
@@ -399,21 +399,21 @@
399 }else{
400 zName += i;
401 }
402 while( zName[0]=='/' ){ zName++; }
403 g.zPath = mprintf("%s/%s/%s", g.zPath, zCheckin, zName);
 
404 if( !file_is_simple_pathname(zName, 1) ){
405 if( sqlite3_strglob("*/", zName)==0 ){
406 zName = mprintf("%sindex.wiki", zName);
407 if( !file_is_simple_pathname(zName, 1) ){
408 goto doc_not_found;
409 }
410 }else{
411 goto doc_not_found;
412 }
413 }
414 zOrigName = zName;
415 if( fossil_strcmp(zCheckin,"ckout")==0 && db_open_local(0)==0 ){
416 sqlite3_snprintf(sizeof(zCheckin), zCheckin, "tip");
417 }
418 if( fossil_strcmp(zCheckin,"ckout")==0 ){
419 /* Read from the local checkout */
420
--- src/doc.c
+++ src/doc.c
@@ -399,21 +399,21 @@
399 }else{
400 zName += i;
401 }
402 while( zName[0]=='/' ){ zName++; }
403 g.zPath = mprintf("%s/%s/%s", g.zPath, zCheckin, zName);
404 zOrigName = zName;
405 if( !file_is_simple_pathname(zName, 1) ){
406 if( sqlite3_strglob("*/", zName)==0 ){
407 zOrigName = zName = mprintf("%sindex.wiki", zName);
408 if( !file_is_simple_pathname(zName, 1) ){
409 goto doc_not_found;
410 }
411 }else{
412 goto doc_not_found;
413 }
414 }
 
415 if( fossil_strcmp(zCheckin,"ckout")==0 && db_open_local(0)==0 ){
416 sqlite3_snprintf(sizeof(zCheckin), zCheckin, "tip");
417 }
418 if( fossil_strcmp(zCheckin,"ckout")==0 ){
419 /* Read from the local checkout */
420

Keyboard Shortcuts

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