line |
true |
false |
branch |
73
|
0 |
0 |
if ( ac->bkupMergeList ) free(ac->bkupMergeList); |
80
|
0 |
0 |
if ( readOnly >= 0 ) ac->readOnly = readOnly; |
89
|
0 |
0 |
while ( p >= ac->currentDir && p[0] == '/' ) *p-- = '\0'; |
|
0 |
0 |
while ( p >= ac->currentDir && p[0] == '/' ) *p-- = '\0'; |
108
|
0 |
0 |
while ( path[0] == '.' && path[1] == '/' ) { |
|
0 |
0 |
while ( path[0] == '.' && path[1] == '/' ) { |
110
|
0 |
0 |
while ( path[0] == '/' ) path++; |
116
|
0 |
0 |
if ( path[0] != '/' && ac->currentDir[0] ) { |
|
0 |
0 |
if ( path[0] != '/' && ac->currentDir[0] ) { |
125
|
0 |
0 |
while ( (pathLen > 1 && path[pathLen - 2] == '/' && path[pathLen - 1] == '.') |
|
0 |
0 |
while ( (pathLen > 1 && path[pathLen - 2] == '/' && path[pathLen - 1] == '.') |
|
0 |
0 |
while ( (pathLen > 1 && path[pathLen - 2] == '/' && path[pathLen - 1] == '.') |
126
|
0 |
0 |
|| (pathLen > 0 && path[pathLen - 1] == '/') ) { |
|
0 |
0 |
|| (pathLen > 0 && path[pathLen - 1] == '/') ) { |
127
|
0 |
0 |
if ( path != fullPath ) { |
131
|
0 |
0 |
if ( path[pathLen - 1] == '/' ) { |
137
|
0 |
0 |
if ( BPC_LogLevel >= 9 ) bpc_logMsgf("splitPath: trimming path = '%s'\n", path); |
139
|
0 |
0 |
if ( !path[0] || (!path[1] && (path[0] == '.' || path[0] == '/')) ) { |
|
0 |
0 |
if ( !path[0] || (!path[1] && (path[0] == '.' || path[0] == '/')) ) { |
|
0 |
0 |
if ( !path[0] || (!path[1] && (path[0] == '.' || path[0] == '/')) ) { |
|
0 |
0 |
if ( !path[0] || (!path[1] && (path[0] == '.' || path[0] == '/')) ) { |
149
|
0 |
0 |
if ( (p = strrchr(path, '/')) ) { |
150
|
0 |
0 |
if ( *path != '/' ) { |
163
|
0 |
0 |
if ( BPC_LogLevel >= 9 ) bpc_logMsgf("splitPath: returning dir = '%s', fileName = '%s', attrib = '%s' from path = '%s'\n", |
175
|
0 |
0 |
} while ( inode ); |
182
|
0 |
0 |
if ( file->type != BPC_FTYPE_DELETED ) return; |
197
|
0 |
0 |
if ( BPC_LogLevel >= 9 ) bpc_logMsgf("bpc_attribCache_loadPath: path = %s -> dir = %s, fileName = %s, attribPath = %s\n", path, dir, fileName, attribPath); |
201
|
0 |
0 |
if ( !attr || attr->key.key != attribPath ) { |
|
0 |
0 |
if ( !attr || attr->key.key != attribPath ) { |
205
|
0 |
0 |
if ( attr ) attr->lruCnt = ac->cacheLruCnt++; |
209
|
0 |
0 |
if ( !(attr->key.key = malloc(attribPathLen + 1)) ) { |
219
|
0 |
0 |
if ( ac->bkupMergeCnt > 0 ) { |
228
|
0 |
0 |
for ( i = 0 ; i < ac->bkupMergeCnt ; i++ ) { |
237
|
0 |
0 |
if ( (status = bpc_attrib_dirRead(&dir, topDir, attribPath, ac->bkupMergeList[i].num)) ) { |
238
|
0 |
0 |
if ( ac->bkupMergeList[i].version < 4 ) { |
243
|
0 |
0 |
if ( (p = strrchr(fullAttribPath, '/')) ) { |
245
|
0 |
0 |
attribDirExists = !stat(fullAttribPath, &st) && S_ISDIR(st.st_mode); |
|
0 |
0 |
attribDirExists = !stat(fullAttribPath, &st) && S_ISDIR(st.st_mode); |
248
|
0 |
0 |
if ( i == ac->bkupMergeCnt - 1 && !attribDirExists ) { |
|
0 |
0 |
if ( i == ac->bkupMergeCnt - 1 && !attribDirExists ) { |
257
|
0 |
0 |
if ( !attribDirExists ) { |
267
|
0 |
0 |
if ( bpc_attrib_dirNeedRewrite(&dir) ) { |
271
|
0 |
0 |
if ( (entries = malloc(entrySize + 1)) && bpc_attrib_getEntries(&dir, entries, entrySize) == entrySize ) { |
|
0 |
0 |
if ( (entries = malloc(entrySize + 1)) && bpc_attrib_getEntries(&dir, entries, entrySize) == entrySize ) { |
272
|
0 |
0 |
for ( entry = entries ; entry < entries + entrySize ; entry += strlen(entry) + 1 ) { |
274
|
0 |
0 |
if ( !file ) continue; |
275
|
0 |
0 |
if ( file->type == BPC_FTYPE_DELETED ) { |
280
|
0 |
0 |
if ( !(fileDest = bpc_attrib_fileGet(&attr->dir, entry, 1)) ) return NULL; |
281
|
0 |
0 |
if ( fileDest->key.key == entry ) { |
294
|
0 |
0 |
if ( entries ) free(entries); |
305
|
0 |
0 |
if ( (status = bpc_attrib_dirRead(&attr->dir, ac->backupTopDir, attribPath, ac->backupNum)) ) { |
308
|
0 |
0 |
if ( bpc_attrib_dirNeedRewrite(&attr->dir) ) { |
316
|
0 |
0 |
if ( attr->dirty ) { |
317
|
0 |
0 |
if ( BPC_LogLevel >= 8 ) bpc_logMsgf("bpc_attribCache_loadPath: will rewrite path = %s -> dir = %s, fileName = %s, attribPath = %s\n", path, dir, fileName, attribPath); |
319
|
0 |
0 |
if ( bpc_hashtable_entryCount(&ac->attrHT) > BPC_ATTRIBCACHE_DIR_COUNT_MAX ) { |
336
|
0 |
0 |
if ( !attr || attr->key.key != attribPath ) { |
|
0 |
0 |
if ( !attr || attr->key.key != attribPath ) { |
337
|
0 |
0 |
if ( attr ) attr->lruCnt = ac->cacheLruCnt++; |
344
|
0 |
0 |
if ( !(attr->key.key = malloc(attribPathLen + 1)) ) { |
353
|
0 |
0 |
if ( ac->bkupMergeCnt > 0 ) { |
361
|
0 |
0 |
for ( i = 0 ; i < ac->bkupMergeCnt ; i++ ) { |
370
|
0 |
0 |
if ( (status = bpc_attrib_dirRead(&dir, inodeDir, attribFile, ac->bkupMergeList[i].num)) ) { |
372
|
0 |
0 |
int attribDirExists = !stat(inodeDir, &st) && S_ISDIR(st.st_mode); |
|
0 |
0 |
int attribDirExists = !stat(inodeDir, &st) && S_ISDIR(st.st_mode); |
373
|
0 |
0 |
if ( ac->bkupMergeList[i].version < 4 || !attribDirExists ) { |
|
0 |
0 |
if ( ac->bkupMergeList[i].version < 4 || !attribDirExists ) { |
382
|
0 |
0 |
if ( bpc_attrib_dirNeedRewrite(&dir) ) { |
386
|
0 |
0 |
if ( (entries = malloc(entrySize + 1)) && bpc_attrib_getEntries(&dir, entries, entrySize) == entrySize ) { |
|
0 |
0 |
if ( (entries = malloc(entrySize + 1)) && bpc_attrib_getEntries(&dir, entries, entrySize) == entrySize ) { |
387
|
0 |
0 |
for ( entry = entries ; entry < entries + entrySize ; entry += strlen(entry) + 1 ) { |
389
|
0 |
0 |
if ( !file ) continue; |
390
|
0 |
0 |
if ( file->type == BPC_FTYPE_DELETED ) { |
395
|
0 |
0 |
if ( !(fileDest = bpc_attrib_fileGet(&attr->dir, entry, 1)) ) return NULL; |
396
|
0 |
0 |
if ( fileDest->key.key == entry ) { |
408
|
0 |
0 |
if ( entries ) free(entries); |
422
|
0 |
0 |
if ( (status = bpc_attrib_dirRead(&attr->dir, inodeDir, attribFile, ac->backupNum)) ) { |
425
|
0 |
0 |
if ( bpc_attrib_dirNeedRewrite(&attr->dir) ) { |
429
|
0 |
0 |
if ( attr->dirty ) { |
430
|
0 |
0 |
if ( BPC_LogLevel >= 8 ) bpc_logMsgf("bpc_attribCache_loadInode: will rewrite path = %s -> dir = %s, fileName = %s\n", attribPath, attribDir, attribFile); |
432
|
0 |
0 |
if ( bpc_hashtable_entryCount(&ac->inodeHT) > BPC_ATTRIBCACHE_DIR_COUNT_MAX ) { |
444
|
0 |
0 |
if ( !(attr = bpc_attribCache_loadPath(ac, fileName, path)) ) return NULL; |
446
|
0 |
0 |
if ( !(file = bpc_attrib_fileGet(&attr->dir, fileName, allocate_if_missing)) ) return NULL; |
448
|
0 |
0 |
if ( allocate_if_missing && file->key.key == fileName ) { |
|
0 |
0 |
if ( allocate_if_missing && file->key.key == fileName ) { |
455
|
0 |
0 |
if ( dontReadInode || file->nlinks == 0 ) return file; |
|
0 |
0 |
if ( dontReadInode || file->nlinks == 0 ) return file; |
466
|
0 |
0 |
if ( !(attr = bpc_attribCache_loadPath(ac, fileName, path)) ) return -1; |
470
|
0 |
0 |
if ( !(fileDest = bpc_attrib_fileGet(&attr->dir, fileName, 1)) ) return -1; |
472
|
0 |
0 |
if ( fileDest->key.key == fileName ) { |
481
|
0 |
0 |
if ( file->nlinks > 0 ) { |
483
|
0 |
0 |
if ( !dontOverwriteInode || !inodeDest ) { |
|
0 |
0 |
if ( !dontOverwriteInode || !inodeDest ) { |
512
|
0 |
0 |
if ( !(attr = bpc_attribCache_loadPath(ac, fileName, path)) ) return -1; |
525
|
0 |
0 |
if ( !(attr = bpc_attribCache_loadInode(ac, indexStr, inode)) ) return NULL; |
527
|
0 |
0 |
if ( !(file = bpc_attrib_fileGet(&attr->dir, indexStr, allocate_if_missing)) ) return NULL; |
529
|
0 |
0 |
if ( allocate_if_missing && file->key.key == indexStr ) { |
|
0 |
0 |
if ( allocate_if_missing && file->key.key == indexStr ) { |
545
|
0 |
0 |
if ( !(attr = bpc_attribCache_loadInode(ac, indexStr, inode)) ) return -1; |
547
|
0 |
0 |
if ( !(inodeDest = bpc_attrib_fileGet(&attr->dir, indexStr, 1)) ) return -1; |
549
|
0 |
0 |
if ( inodeDest->key.key == indexStr ) { |
565
|
0 |
0 |
if ( !(attr = bpc_attribCache_loadInode(ac, indexStr, inode)) ) return -1; |
581
|
0 |
0 |
if ( pathLen >= BPC_MAXPATHLEN - 3 ) return -1; |
585
|
0 |
0 |
if ( !attr ) return -1; |
599
|
0 |
0 |
if ( info->entryIdx < 0 ) return; |
600
|
0 |
0 |
if ( info->entries ) { |
601
|
0 |
0 |
if ( info->entryIdx + len + (ssize_t)sizeof(ino_t) > info->entrySize ) { |
625
|
0 |
0 |
if ( pathLen >= BPC_MAXPATHLEN - 3 ) return -1; |
626
|
0 |
0 |
if ( pathLen == 1 && path[0] == '.' ) { |
|
0 |
0 |
if ( pathLen == 1 && path[0] == '.' ) { |
627
|
0 |
0 |
if ( ac->currentDir[0] ) { |
638
|
0 |
0 |
if ( !attr ) return -1; |
645
|
0 |
0 |
if ( entries && entrySize >= (ssize_t)(5 + 2 * sizeof(ino_t)) ) { |
|
0 |
0 |
if ( entries && entrySize >= (ssize_t)(5 + 2 * sizeof(ino_t)) ) { |
682
|
0 |
0 |
if ( !info->ac->readOnly && !info->all && info->path ) { |
|
0 |
0 |
if ( !info->ac->readOnly && !info->all && info->path ) { |
|
0 |
0 |
if ( !info->ac->readOnly && !info->all && info->path ) { |
683
|
0 |
0 |
if ( BPC_LogLevel >= 9 ) bpc_logMsgf("bpc_attribCache_dirWrite: comparing %s vs key %s\n", info->path, attr->key.key); |
684
|
0 |
0 |
if ( strncmp(info->path, attr->key.key, info->pathLen) |
685
|
0 |
0 |
|| (((char*)attr->key.key)[info->pathLen] != '/' && ((char*)attr->key.key)[info->pathLen] != '\0') ) { |
|
0 |
0 |
|| (((char*)attr->key.key)[info->pathLen] != '/' && ((char*)attr->key.key)[info->pathLen] != '\0') ) { |
686
|
0 |
0 |
if ( BPC_LogLevel >= 9 ) bpc_logMsgf("bpc_attribCache_dirWrite: skipping %s (doesn't match %s)\n", (char*)attr->key.key, info->path); |
690
|
0 |
0 |
if ( !info->ac->readOnly && attr->dirty ) { |
|
0 |
0 |
if ( !info->ac->readOnly && attr->dirty ) { |
692
|
0 |
0 |
if ( BPC_LogLevel >= 6 ) bpc_logMsgf("bpc_attribCache_dirWrite: writing %s/%s with %d entries (oldDigest = 0x%02x%02x...)\n", |
|
0 |
0 |
if ( BPC_LogLevel >= 6 ) bpc_logMsgf("bpc_attribCache_dirWrite: writing %s/%s with %d entries (oldDigest = 0x%02x%02x...)\n", |
|
0 |
0 |
if ( BPC_LogLevel >= 6 ) bpc_logMsgf("bpc_attribCache_dirWrite: writing %s/%s with %d entries (oldDigest = 0x%02x%02x...)\n", |
695
|
0 |
0 |
if ( (status = bpc_attrib_dirWrite(info->ac->deltaInfo, &attr->dir, info->ac->backupTopDir, attr->key.key, oldDigest)) ) { |
705
|
0 |
0 |
if ( attr->key.key ) free(attr->key.key); |
711
|
0 |
0 |
if ( info->entryIdx >= info->entryCnt ) return; |
733
|
0 |
0 |
if ( info->entryCnt == 0 ) return; |
734
|
0 |
0 |
if ( !(info->entries = malloc(info->entryCnt * sizeof(*info->entries))) ) { |
748
|
0 |
0 |
for ( i = 0 ; i < info->entryCnt / 2 ; i++ ) { |
752
|
0 |
0 |
if ( info->entries ) free(info->entries); |
766
|
0 |
0 |
if ( path ) { |
783
|
0 |
0 |
if ( !all && !path ) { |
|
0 |
0 |
if ( !all && !path ) { |
797
|
0 |
0 |
if ( info.errorCnt ) { |
816
|
0 |
0 |
while ( dirName[0] == '.' && dirName[1] == '/' ) dirName += 2; |
|
0 |
0 |
while ( dirName[0] == '.' && dirName[1] == '/' ) dirName += 2; |
817
|
0 |
0 |
while ( dirName[0] == '/' ) dirName++; |
818
|
0 |
0 |
} while ( p != dirName ); |
820
|
0 |
0 |
if ( backupNum < 0 || ac->bkupMergeCnt <= 0 ) { |
|
0 |
0 |
if ( backupNum < 0 || ac->bkupMergeCnt <= 0 ) { |
825
|
0 |
0 |
if ( (dirName[0] == '/' && dirName[1] == '\0') || dirName[0] == '\0' || len >= BPC_MAXPATHLEN - 1 ) { |
|
0 |
0 |
if ( (dirName[0] == '/' && dirName[1] == '\0') || dirName[0] == '\0' || len >= BPC_MAXPATHLEN - 1 ) { |
|
0 |
0 |
if ( (dirName[0] == '/' && dirName[1] == '\0') || dirName[0] == '\0' || len >= BPC_MAXPATHLEN - 1 ) { |
|
0 |
0 |
if ( (dirName[0] == '/' && dirName[1] == '\0') || dirName[0] == '\0' || len >= BPC_MAXPATHLEN - 1 ) { |