line |
true |
false |
branch |
31
|
0 |
0 |
if ( BPC_LogLevel >= 6 ) bpc_logMsgf("bpc_path_create(%s)\n", path); |
35
|
0 |
0 |
if ( !stat(path, &st) && S_ISDIR(st.st_mode) ) return 0; |
|
0 |
0 |
if ( !stat(path, &st) && S_ISDIR(st.st_mode) ) return 0; |
42
|
0 |
0 |
while ( p > path && p[-1] == '/' ) p--; |
|
0 |
0 |
while ( p > path && p[-1] == '/' ) p--; |
43
|
0 |
0 |
if ( *p == '/' ) *p = '\0'; |
44
|
0 |
0 |
while ( p > path ) { |
45
|
0 |
0 |
while ( p > path && p[-1] != '/' ) p--; |
|
0 |
0 |
while ( p > path && p[-1] != '/' ) p--; |
46
|
0 |
0 |
while ( p > path && p[-1] == '/' ) p--; |
|
0 |
0 |
while ( p > path && p[-1] == '/' ) p--; |
47
|
0 |
0 |
if ( *p == '/' ) { |
50
|
0 |
0 |
if ( !stat(path, &st) && S_ISDIR(st.st_mode) ) break; |
|
0 |
0 |
if ( !stat(path, &st) && S_ISDIR(st.st_mode) ) break; |
53
|
0 |
0 |
if ( BPC_LogLevel >= 9 ) bpc_logMsgf("bpc_path_create: found that %s exists (%d levels up)\n", path, levels); |
58
|
0 |
0 |
while ( levels-- > 0 ) { |
61
|
0 |
0 |
if ( mkdir(path, ACCESSPERMS) < 0 && errno != EEXIST) { |
|
0 |
0 |
if ( mkdir(path, ACCESSPERMS) < 0 && errno != EEXIST) { |
65
|
0 |
0 |
if ( BPC_LogLevel >= 9 ) bpc_logMsgf("bpc_path_create: created %s\n", path); |
86
|
0 |
0 |
if ( BPC_LogLevel >= 6 ) bpc_logMsgf("bpc_path_remove(%s)\n", path); |
87
|
0 |
0 |
if ( !(dir = opendir(path)) ) { |
91
|
0 |
0 |
while ( (dp = readdir(dir)) ) { |
92
|
0 |
0 |
if ( !strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..") ) continue; |
|
0 |
0 |
if ( !strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..") ) continue; |
94
|
0 |
0 |
if ( BPC_LogLevel >= 8 ) bpc_logMsgf("bpc_path_remove: removing %s\n", filePath); |
95
|
0 |
0 |
if ( stat(filePath, &st) ) { |
102
|
0 |
0 |
if ( S_ISDIR(st.st_mode) ) { |
107
|
0 |
0 |
if ( !dirList ) { |
109
|
0 |
0 |
if ( !(dirList = malloc(dirListSize)) ) { |
114
|
0 |
0 |
if ( dirListLen + strlen(dp->d_name) + 1 >= dirListSize ) { |
116
|
0 |
0 |
if ( !(dirList = realloc(dirList, dirListSize)) ) { |
127
|
0 |
0 |
if ( !strncmp(dp->d_name, "attrib", 6) ) { |
131
|
0 |
0 |
if ( bpc_attrib_dirRead(&dir, NULL, filePath, 0) ) { |
135
|
0 |
0 |
if ( BPC_LogLevel >= 9 ) bpc_logMsgf("bpc_path_remove: adjusting ref counts from attrib file %s\n", filePath); |
136
|
0 |
0 |
if ( !unlink(filePath) ) { |
144
|
0 |
0 |
if ( unlink(filePath) ) errorCnt++; |
152
|
0 |
0 |
if ( dirList ) { |
153
|
0 |
0 |
for ( dirListP = dirList ; dirListP < dirList + dirListLen ; dirListP += strlen(dirListP) + 1 ) { |
159
|
0 |
0 |
if ( rmdir(path) ) errorCnt++; |
177
|
0 |
0 |
if ( BPC_LogLevel >= 6 ) bpc_logMsgf("bpc_path_refCountAll(%s)\n", path); |
178
|
0 |
0 |
if ( !(dir = opendir(path)) ) { |
181
|
0 |
0 |
while ( (dp = readdir(dir)) ) { |
182
|
0 |
0 |
if ( !strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..") ) continue; |
|
0 |
0 |
if ( !strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..") ) continue; |
184
|
0 |
0 |
if ( BPC_LogLevel >= 8 ) bpc_logMsgf("bpc_path_refCountAll: got %s\n", filePath); |
185
|
0 |
0 |
if ( stat(filePath, &st) ) continue; |
186
|
0 |
0 |
if ( S_ISDIR(st.st_mode) ) { |
191
|
0 |
0 |
if ( !dirList ) { |
193
|
0 |
0 |
if ( !(dirList = malloc(dirListSize)) ) { |
198
|
0 |
0 |
if ( dirListLen + strlen(dp->d_name) + 1 >= dirListSize ) { |
200
|
0 |
0 |
if ( !(dirList = realloc(dirList, dirListSize)) ) { |
211
|
0 |
0 |
if ( !strncmp(dp->d_name, "attrib", 6) ) { |
215
|
0 |
0 |
if ( bpc_attrib_dirRead(&dir, path, dp->d_name, 0) ) { |
219
|
0 |
0 |
if ( BPC_LogLevel >= 9 ) bpc_logMsgf("bpc_path_refCountAll: adjusting ref counts from attrib file %s\n", filePath); |
230
|
0 |
0 |
if ( dirList ) { |
231
|
0 |
0 |
for ( dirListP = dirList ; dirListP < dirList + dirListLen ; dirListP += strlen(dirListP) + 1 ) { |
263
|
0 |
0 |
return fcntl(fd, block ? F_SETLKW : F_SETLK, &lock); |
283
|
0 |
0 |
if ( (fd = open(lockFile, O_CREAT | O_RDWR, 0660)) < 0 ) { |
287
|
0 |
0 |
if ( bpc_lockRangeFd(fd, offset, len, block) ) { |
289
|
0 |
0 |
if ( block ) { |
299
|
0 |
0 |
if ( lockFd >= 0 ) close(lockFd); |