aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2020-11-23 17:36:06 +0000
committerdrh <drh@noemail.net>2020-11-23 17:36:06 +0000
commitd46beb06aab941bf165a9d216d08207ab6c1440d (patch)
treee09322659dc4670cff8bbd4926f29a5662ac0f78 /src/os_unix.c
parent39acaec16c7255108bf36e7110733df5098bdd6c (diff)
downloadsqlite-d46beb06aab941bf165a9d216d08207ab6c1440d.tar.gz
sqlite-d46beb06aab941bf165a9d216d08207ab6c1440d.zip
In os_unix.c, put ALWAYS() on unreachable branches associated with pathname
normalization. FossilOrigin-Name: b45a08e3c7edfa76b699d3e29f28daa5bd08039668ec57121e4e85edf36150f1
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index ee7ef2687..a688ed270 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -6361,7 +6361,7 @@ static int unixBackupDir(const char *z, int *pJ){
int j = *pJ;
int i;
if( j<=0 ) return 0;
- for(i=j-1; i>0 && z[i-1]!='/'; i--){}
+ for(i=j-1; ALWAYS(i>0) && z[i-1]!='/'; i--){}
if( z[i]=='.' && i==j-2 && z[i+1]=='.' ) return 0;
*pJ = i-1;
return 1;
@@ -6405,6 +6405,7 @@ static int mkFullPathname(
}
zOut[j] = 0;
+ assert( zOut[0]=='/' );
for(i=j=0; zOut[i]; i++){
if( zOut[i]=='/' ){
/* Skip over internal "/." directory components */
@@ -6425,10 +6426,10 @@ static int mkFullPathname(
continue;
}
}
- if( j>=0 ) zOut[j] = zOut[i];
+ if( ALWAYS(j>=0) ) zOut[j] = zOut[i];
j++;
}
- if( j==0 ) zOut[j++] = '/';
+ if( NEVER(j==0) ) zOut[j++] = '/';
zOut[j] = 0;
return SQLITE_OK;
}