line |
true |
false |
branch |
51
|
0 |
91 |
if ((builder = malloc(sizeof(*builder))) == NULL) { |
55
|
91 |
0 |
if ((builder->buf = b_buffer_new(block_factor? block_factor: B_BUFFER_DEFAULT_FACTOR)) == NULL) { |
|
0 |
91 |
if ((builder->buf = b_buffer_new(block_factor? block_factor: B_BUFFER_DEFAULT_FACTOR)) == NULL) { |
59
|
0 |
91 |
if ((builder->err = b_error_new()) == NULL) { |
85
|
0 |
6628 |
if (builder == NULL) return B_BUILDER_NONE; |
95
|
0 |
6713 |
if (builder == NULL) return NULL; |
101
|
0 |
6678 |
if (builder == NULL) return NULL; |
107
|
0 |
0 |
if (builder == NULL) return; |
150
|
0 |
5834 |
if (path == NULL) { |
154
|
0 |
5834 |
if (b_header_encode_longlink_block(block, path, type) == NULL) { |
160
|
0 |
5834 |
if ((*wrlen = b_file_write_path_blocks(buf, path)) < 0) { |
161
|
0 |
0 |
if (err) { |
183
|
0 |
6670 |
if ((data = malloc(sizeof(*data))) == NULL) { |
187
|
0 |
6670 |
if ((parts = b_path_new(path)) == NULL) { |
191
|
0 |
6670 |
if ((prefix_items = b_stack_new(0)) == NULL) { |
195
|
0 |
6670 |
if ((suffix_items = b_stack_new(0)) == NULL) { |
205
|
0 |
6670 |
if (b_stack_count(parts) == 0) { |
212
|
14 |
6656 |
if (b_string_len(b_stack_item_at(parts, 0)) == 0) { |
218
|
6788 |
6670 |
while ((item = b_stack_pop(parts)) != NULL) { |
219
|
118 |
6670 |
if (suffix_size && suffix_size + item->len >= B_HEADER_SUFFIX_SIZE) { |
|
7 |
111 |
if (suffix_size && suffix_size + item->len >= B_HEADER_SUFFIX_SIZE) { |
224
|
150 |
6638 |
if ( ( (st->st_mode & S_IFMT) == S_IFDIR ) && ( suffix_size + item->len + 1 >= B_HEADER_SUFFIX_SIZE ) ) { |
|
7 |
143 |
if ( ( (st->st_mode & S_IFMT) == S_IFDIR ) && ( suffix_size + item->len + 1 >= B_HEADER_SUFFIX_SIZE ) ) { |
228
|
7 |
6781 |
if (add_to_prefix) { |
229
|
0 |
7 |
if (prefix_size) prefix_size++; /* Add 1 to make room for path separator */ |
232
|
111 |
6670 |
if (suffix_size) suffix_size++; /* ^-- Ditto */ |
236
|
7 |
6781 |
if (b_stack_push(add_to_prefix? prefix_items: suffix_items, item) == NULL) { |
|
0 |
6788 |
if (b_stack_push(add_to_prefix? prefix_items: suffix_items, item) == NULL) { |
246
|
0 |
6670 |
if ((data->prefix = b_string_join("/", b_stack_reverse(prefix_items))) == NULL) { |
250
|
0 |
6670 |
if ((data->suffix = b_string_join("/", b_stack_reverse(suffix_items))) == NULL) { |
258
|
87 |
6583 |
if ((st->st_mode & S_IFMT) == S_IFDIR) { |
271
|
828 |
5842 |
if (suffix_size > B_HEADER_SUFFIX_SIZE || prefix_size > B_HEADER_PREFIX_SIZE) { |
|
0 |
828 |
if (suffix_size > B_HEADER_SUFFIX_SIZE || prefix_size > B_HEADER_PREFIX_SIZE) { |
302
|
6583 |
87 |
return (st->st_mode & S_IFMT) == S_IFREG && st->st_nlink > 1; |
|
6 |
6577 |
return (st->st_mode & S_IFMT) == S_IFREG && st->st_nlink > 1; |
310
|
0 |
6670 |
if ((ret = malloc(sizeof(*ret))) == NULL) { |
314
|
0 |
6670 |
if ((path_data = path_split(member_name, st)) == NULL) { |
324
|
6583 |
87 |
ret->size = (st->st_mode & S_IFMT) == S_IFREG? st->st_size: 0; |
335
|
0 |
6670 |
if ((st->st_mode & S_IFMT) == S_IFLNK) { |
336
|
0 |
0 |
if ((ret->linkdest = b_readlink(path, st)) == NULL) { |
339
|
6 |
6664 |
} else if (is_hardlink(st) && builder->hardlink_lookup) { |
|
6 |
0 |
} else if (is_hardlink(st) && builder->hardlink_lookup) { |
342
|
3 |
3 |
if (linkdest = builder->hardlink_lookup(builder->hardlink_cache, st->st_dev, st->st_ino, member_name)) { |
348
|
3 |
6667 |
if (ret->linkdest && b_string_len(ret->linkdest) > B_HEADER_LINKDEST_SIZE) { |
|
0 |
3 |
if (ret->linkdest && b_string_len(ret->linkdest) > B_HEADER_LINKDEST_SIZE) { |
382
|
0 |
6670 |
if (buf == NULL) { |
387
|
6670 |
0 |
if (err) { |
391
|
0 |
6670 |
if ((header = header_for_file(builder, path, member_name, st)) == NULL) { |
392
|
0 |
0 |
if (err) { |
404
|
6670 |
0 |
if (builder->user_lookup != NULL) { |
407
|
0 |
6670 |
if (builder->user_lookup(builder->user_cache, st->st_uid, st->st_gid, &user, &group) < 0) { |
408
|
0 |
0 |
if (err) { |
415
|
0 |
6670 |
if (b_header_set_usernames(header, user, group) < 0) { |
425
|
828 |
5842 |
if (header->truncated || header->truncated_link) { |
|
0 |
828 |
if (header->truncated || header->truncated_link) { |
432
|
4 |
5838 |
if (!(builder->options & B_BUILDER_EXTENSIONS_MASK)) { |
435
|
4 |
0 |
if (err) { |
442
|
0 |
5838 |
if ((block = b_buffer_get_block(buf, B_HEADER_SIZE, &wrlen)) == NULL) { |
446
|
0 |
5838 |
if ((longlink_path = b_string_dup(member_name)) == NULL) { |
450
|
0 |
5838 |
if ((st->st_mode & S_IFMT) == S_IFDIR) { |
451
|
0 |
0 |
if ((b_string_append_str(longlink_path, "/")) == NULL) { |
456
|
5834 |
4 |
if (builder->options & B_BUILDER_GNU_EXTENSIONS) { |
457
|
5834 |
0 |
if (header->truncated && encode_longlink(builder, block, longlink_path, B_HEADER_LONGLINK_TYPE, &wrlen) < 0) { |
|
0 |
5834 |
if (header->truncated && encode_longlink(builder, block, longlink_path, B_HEADER_LONGLINK_TYPE, &wrlen) < 0) { |
461
|
0 |
5834 |
if (header->truncated_link && encode_longlink(builder, block, header->linkdest, B_HEADER_LONGDEST_TYPE, &wrlen) < 0) { |
|
0 |
0 |
if (header->truncated_link && encode_longlink(builder, block, header->linkdest, B_HEADER_LONGDEST_TYPE, &wrlen) < 0) { |
464
|
4 |
0 |
} else if (builder->options & B_BUILDER_PAX_EXTENSIONS) { |
465
|
0 |
4 |
if (b_header_encode_pax_block(block, header, longlink_path) == NULL) { |
471
|
0 |
4 |
if ((wrlen = b_file_write_pax_path_blocks(buf, longlink_path, header->linkdest)) < 0) { |
472
|
0 |
0 |
if (err) { |
486
|
0 |
6666 |
if ((block = b_buffer_get_block(buf, B_HEADER_SIZE, &wrlen)) == NULL) { |
490
|
0 |
6666 |
if (b_header_encode_block(block, header) == NULL) { |
499
|
6576 |
90 |
if (B_HEADER_IS_IFREG(header) && fd > 0) { |
|
6576 |
0 |
if (B_HEADER_IS_IFREG(header) && fd > 0) { |
500
|
4 |
6572 |
if ((wrlen = b_file_write_contents(buf, fd, header->size)) < 0) { |
501
|
4 |
0 |
if (err) { |
529
|
0 |
91 |
if (builder == NULL) return; |
531
|
91 |
0 |
if (builder->buf) { |
536
|
91 |
0 |
if (builder->err) { |