| 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++ ) { |
|
238
|
0 |
0 |
attribFileExists = !stat(fullAttribPath, &st) && S_ISREG(st.st_mode); |
|
|
0 |
0 |
attribFileExists = !stat(fullAttribPath, &st) && S_ISREG(st.st_mode); |
|
240
|
0 |
0 |
if ( !attribFileExists ) { |
|
242
|
0 |
0 |
if ( (p = strrchr(fullAttribPath, '/')) ) { |
|
244
|
0 |
0 |
attribDirExists = !stat(fullAttribPath, &st) && S_ISDIR(st.st_mode); |
|
|
0 |
0 |
attribDirExists = !stat(fullAttribPath, &st) && S_ISDIR(st.st_mode); |
|
247
|
0 |
0 |
if ( BPC_LogLevel >= 9 ) bpc_logMsgf("bpc_attribCache_loadPath: path = %s, file exists = %d, dir exists = %d\n", fullAttribPath, attribFileExists, attribDirExists); |
|
249
|
0 |
0 |
if ( ac->bkupMergeList[i].version < 4 && i == ac->bkupMergeCnt - 1 && !attribFileExists && !attribDirExists ) { |
|
|
0 |
0 |
if ( ac->bkupMergeList[i].version < 4 && i == ac->bkupMergeCnt - 1 && !attribFileExists && !attribDirExists ) { |
|
|
0 |
0 |
if ( ac->bkupMergeList[i].version < 4 && i == ac->bkupMergeCnt - 1 && !attribFileExists && !attribDirExists ) { |
|
|
0 |
0 |
if ( ac->bkupMergeList[i].version < 4 && i == ac->bkupMergeCnt - 1 && !attribFileExists && !attribDirExists ) { |
|
257
|
0 |
0 |
if ( (ac->bkupMergeList[i].version < 4 && !attribFileExists) || !attribDirExists ) { |
|
|
0 |
0 |
if ( (ac->bkupMergeList[i].version < 4 && !attribFileExists) || !attribDirExists ) { |
|
|
0 |
0 |
if ( (ac->bkupMergeList[i].version < 4 && !attribFileExists) || !attribDirExists ) { |
|
264
|
0 |
0 |
if ( (status = bpc_attrib_dirRead(&dir, topDir, attribPath, ac->bkupMergeList[i].num)) ) { |
|
268
|
0 |
0 |
if ( (entries = malloc(entrySize)) && bpc_attrib_getEntries(&dir, entries, entrySize) == entrySize ) { |
|
|
0 |
0 |
if ( (entries = malloc(entrySize)) && bpc_attrib_getEntries(&dir, entries, entrySize) == entrySize ) { |
|
269
|
0 |
0 |
for ( fileName = entries ; fileName < entries + entrySize ; fileName += strlen(fileName) + 1 ) { |
|
271
|
0 |
0 |
if ( !file ) continue; |
|
272
|
0 |
0 |
if ( file->type == BPC_FTYPE_DELETED ) { |
|
277
|
0 |
0 |
if ( !(fileDest = bpc_attrib_fileGet(&attr->dir, fileName, 1)) ) return NULL; |
|
278
|
0 |
0 |
if ( fileDest->key.key == fileName ) { |
|
291
|
0 |
0 |
if ( entries ) free(entries); |
|
302
|
0 |
0 |
if ( (status = bpc_attrib_dirRead(&attr->dir, ac->backupTopDir, attribPath, ac->backupNum)) ) { |
|
310
|
0 |
0 |
if ( bpc_hashtable_entryCount(&ac->attrHT) > BPC_ATTRIBCACHE_DIR_COUNT_MAX ) { |
|
327
|
0 |
0 |
if ( !attr || attr->key.key != attribPath ) { |
|
|
0 |
0 |
if ( !attr || attr->key.key != attribPath ) { |
|
328
|
0 |
0 |
if ( attr ) attr->lruCnt = ac->cacheLruCnt++; |
|
335
|
0 |
0 |
if ( !(attr->key.key = malloc(attribPathLen + 1)) ) { |
|
344
|
0 |
0 |
if ( ac->bkupMergeCnt > 0 ) { |
|
352
|
0 |
0 |
for ( i = 0 ; i < ac->bkupMergeCnt ; i++ ) { |
|
362
|
0 |
0 |
attribFileExists = !stat(fullAttribPath, &st) && S_ISREG(st.st_mode); |
|
|
0 |
0 |
attribFileExists = !stat(fullAttribPath, &st) && S_ISREG(st.st_mode); |
|
363
|
0 |
0 |
if ( !attribFileExists ) { |
|
364
|
0 |
0 |
attribDirExists = !stat(inodeDir, &st) && S_ISDIR(st.st_mode); |
|
|
0 |
0 |
attribDirExists = !stat(inodeDir, &st) && S_ISDIR(st.st_mode); |
|
366
|
0 |
0 |
if ( BPC_LogLevel >= 9 ) bpc_logMsgf("bpc_attribCache_loadInode: path = %s, file exists = %d, dir exists = %d\n", fullAttribPath, attribFileExists, attribDirExists); |
|
368
|
0 |
0 |
if ( (ac->bkupMergeList[i].version < 4 && !attribFileExists) || !attribDirExists ) { |
|
|
0 |
0 |
if ( (ac->bkupMergeList[i].version < 4 && !attribFileExists) || !attribDirExists ) { |
|
|
0 |
0 |
if ( (ac->bkupMergeList[i].version < 4 && !attribFileExists) || !attribDirExists ) { |
|
375
|
0 |
0 |
if ( (status = bpc_attrib_dirRead(&dir, inodeDir, attribFile, ac->bkupMergeList[i].num)) ) { |
|
379
|
0 |
0 |
if ( (entries = malloc(entrySize)) && bpc_attrib_getEntries(&dir, entries, entrySize) == entrySize ) { |
|
|
0 |
0 |
if ( (entries = malloc(entrySize)) && bpc_attrib_getEntries(&dir, entries, entrySize) == entrySize ) { |
|
380
|
0 |
0 |
for ( fileName = entries ; fileName < entries + entrySize ; fileName += strlen(fileName) + 1 ) { |
|
382
|
0 |
0 |
if ( !file ) continue; |
|
383
|
0 |
0 |
if ( file->type == BPC_FTYPE_DELETED ) { |
|
388
|
0 |
0 |
if ( !(fileDest = bpc_attrib_fileGet(&attr->dir, fileName, 1)) ) return NULL; |
|
389
|
0 |
0 |
if ( fileDest->key.key == fileName ) { |
|
401
|
0 |
0 |
if ( entries ) free(entries); |
|
415
|
0 |
0 |
if ( (status = bpc_attrib_dirRead(&attr->dir, inodeDir, attribFile, ac->backupNum)) ) { |
|
419
|
0 |
0 |
if ( bpc_hashtable_entryCount(&ac->inodeHT) > BPC_ATTRIBCACHE_DIR_COUNT_MAX ) { |
|
431
|
0 |
0 |
if ( !(attr = bpc_attribCache_loadPath(ac, fileName, path)) ) return NULL; |
|
433
|
0 |
0 |
if ( !(file = bpc_attrib_fileGet(&attr->dir, fileName, allocate_if_missing)) ) return NULL; |
|
435
|
0 |
0 |
if ( allocate_if_missing && file->key.key == fileName ) { |
|
|
0 |
0 |
if ( allocate_if_missing && file->key.key == fileName ) { |
|
442
|
0 |
0 |
if ( dontReadInode || file->nlinks == 0 ) return file; |
|
|
0 |
0 |
if ( dontReadInode || file->nlinks == 0 ) return file; |
|
453
|
0 |
0 |
if ( !(attr = bpc_attribCache_loadPath(ac, fileName, path)) ) return -1; |
|
457
|
0 |
0 |
if ( !(fileDest = bpc_attrib_fileGet(&attr->dir, fileName, 1)) ) return -1; |
|
459
|
0 |
0 |
if ( fileDest->key.key == fileName ) { |
|
468
|
0 |
0 |
if ( file->nlinks > 0 ) { |
|
470
|
0 |
0 |
if ( !dontOverwriteInode || !inodeDest ) { |
|
|
0 |
0 |
if ( !dontOverwriteInode || !inodeDest ) { |
|
499
|
0 |
0 |
if ( !(attr = bpc_attribCache_loadPath(ac, fileName, path)) ) return -1; |
|
512
|
0 |
0 |
if ( !(attr = bpc_attribCache_loadInode(ac, indexStr, inode)) ) return NULL; |
|
514
|
0 |
0 |
if ( !(file = bpc_attrib_fileGet(&attr->dir, indexStr, allocate_if_missing)) ) return NULL; |
|
516
|
0 |
0 |
if ( allocate_if_missing && file->key.key == indexStr ) { |
|
|
0 |
0 |
if ( allocate_if_missing && file->key.key == indexStr ) { |
|
532
|
0 |
0 |
if ( !(attr = bpc_attribCache_loadInode(ac, indexStr, inode)) ) return -1; |
|
534
|
0 |
0 |
if ( !(inodeDest = bpc_attrib_fileGet(&attr->dir, indexStr, 1)) ) return -1; |
|
536
|
0 |
0 |
if ( inodeDest->key.key == indexStr ) { |
|
552
|
0 |
0 |
if ( !(attr = bpc_attribCache_loadInode(ac, indexStr, inode)) ) return -1; |
|
568
|
0 |
0 |
if ( pathLen >= BPC_MAXPATHLEN - 3 ) return -1; |
|
572
|
0 |
0 |
if ( !attr ) return -1; |
|
586
|
0 |
0 |
if ( info->entryIdx < 0 ) return; |
|
587
|
0 |
0 |
if ( info->entries ) { |
|
588
|
0 |
0 |
if ( info->entryIdx + len + (ssize_t)sizeof(ino_t) > info->entrySize ) { |
|
612
|
0 |
0 |
if ( pathLen >= BPC_MAXPATHLEN - 3 ) return -1; |
|
613
|
0 |
0 |
if ( pathLen == 1 && path[0] == '.' ) { |
|
|
0 |
0 |
if ( pathLen == 1 && path[0] == '.' ) { |
|
614
|
0 |
0 |
if ( ac->currentDir[0] ) { |
|
625
|
0 |
0 |
if ( !attr ) return -1; |
|
632
|
0 |
0 |
if ( entries && entrySize >= (ssize_t)(5 + 2 * sizeof(ino_t)) ) { |
|
|
0 |
0 |
if ( entries && entrySize >= (ssize_t)(5 + 2 * sizeof(ino_t)) ) { |
|
669
|
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 ) { |
|
670
|
0 |
0 |
if ( BPC_LogLevel >= 9 ) bpc_logMsgf("bpc_attribCache_dirWrite: comparing %s vs key %s\n", info->path, attr->key.key); |
|
671
|
0 |
0 |
if ( strncmp(info->path, attr->key.key, info->pathLen) |
|
672
|
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') ) { |
|
673
|
0 |
0 |
if ( BPC_LogLevel >= 9 ) bpc_logMsgf("bpc_attribCache_dirWrite: skipping %s (doesn't match %s)\n", (char*)attr->key.key, info->path); |
|
677
|
0 |
0 |
if ( !info->ac->readOnly && attr->dirty ) { |
|
|
0 |
0 |
if ( !info->ac->readOnly && attr->dirty ) { |
|
679
|
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", |
|
682
|
0 |
0 |
if ( (status = bpc_attrib_dirWrite(info->ac->deltaInfo, &attr->dir, info->ac->backupTopDir, attr->key.key, oldDigest)) ) { |
|
692
|
0 |
0 |
if ( attr->key.key ) free(attr->key.key); |
|
698
|
0 |
0 |
if ( info->entryIdx >= info->entryCnt ) return; |
|
720
|
0 |
0 |
if ( info->entryCnt == 0 ) return; |
|
721
|
0 |
0 |
if ( !(info->entries = malloc(info->entryCnt * sizeof(*info->entries))) ) { |
|
735
|
0 |
0 |
for ( i = 0 ; i < info->entryCnt / 2 ; i++ ) { |
|
739
|
0 |
0 |
if ( info->entries ) free(info->entries); |
|
753
|
0 |
0 |
if ( path ) { |
|
770
|
0 |
0 |
if ( !all && !path ) { |
|
|
0 |
0 |
if ( !all && !path ) { |
|
784
|
0 |
0 |
if ( info.errorCnt ) { |
|
803
|
0 |
0 |
while ( dirName[0] == '.' && dirName[1] == '/' ) dirName += 2; |
|
|
0 |
0 |
while ( dirName[0] == '.' && dirName[1] == '/' ) dirName += 2; |
|
804
|
0 |
0 |
while ( dirName[0] == '/' ) dirName++; |
|
805
|
0 |
0 |
} while ( p != dirName ); |
|
807
|
0 |
0 |
if ( backupNum < 0 || ac->bkupMergeCnt <= 0 ) { |
|
|
0 |
0 |
if ( backupNum < 0 || ac->bkupMergeCnt <= 0 ) { |
|
812
|
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 ) { |