1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

In os_unix.c, put ALWAYS() on unreachable branches associated with pathname

normalization.

FossilOrigin-Name: b45a08e3c7edfa76b699d3e29f28daa5bd08039668ec57121e4e85edf36150f1
This commit is contained in:
drh
2020-11-23 17:36:06 +00:00
parent 39acaec16c
commit d46beb06aa
3 changed files with 12 additions and 11 deletions

View File

@@ -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;
}