| line |
true |
false |
branch |
|
51
|
0 |
92 |
if ((builder = malloc(sizeof(*builder))) == NULL) { |
|
55
|
92 |
0 |
if ((builder->buf = b_buffer_new(block_factor? block_factor: B_BUFFER_DEFAULT_FACTOR)) == NULL) { |
|
|
0 |
92 |
if ((builder->buf = b_buffer_new(block_factor? block_factor: B_BUFFER_DEFAULT_FACTOR)) == NULL) { |
|
59
|
0 |
92 |
if ((builder->err = b_error_new()) == NULL) { |
|
85
|
0 |
6629 |
if (builder == NULL) return B_BUILDER_NONE; |
|
95
|
0 |
6715 |
if (builder == NULL) return NULL; |
|
101
|
0 |
6680 |
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 |
7069 |
if ((data = malloc(sizeof(*data))) == NULL) { |
|
187
|
0 |
7069 |
if ((parts = b_path_new(path)) == NULL) { |
|
191
|
0 |
7069 |
if ((prefix_items = b_stack_new(0)) == NULL) { |
|
195
|
0 |
7069 |
if ((suffix_items = b_stack_new(0)) == NULL) { |
|
205
|
0 |
7069 |
if (b_stack_count(parts) == 0) { |
|
212
|
413 |
6656 |
if (b_string_len(b_stack_item_at(parts, 0)) == 0) { |
|
218
|
7984 |
7069 |
while ((item = b_stack_pop(parts)) != NULL) { |
|
219
|
915 |
7069 |
if (suffix_size && suffix_size + item->len >= B_HEADER_SUFFIX_SIZE) { |
|
|
7 |
908 |
if (suffix_size && suffix_size + item->len >= B_HEADER_SUFFIX_SIZE) { |
|
224
|
152 |
7832 |
if ( ( (st->st_mode & S_IFMT) == S_IFDIR ) && ( suffix_size + item->len + 1 >= B_HEADER_SUFFIX_SIZE ) ) { |
|
|
7 |
145 |
if ( ( (st->st_mode & S_IFMT) == S_IFDIR ) && ( suffix_size + item->len + 1 >= B_HEADER_SUFFIX_SIZE ) ) { |
|
228
|
7 |
7977 |
if (add_to_prefix) { |
|
229
|
0 |
7 |
if (prefix_size) prefix_size++; /* Add 1 to make room for path separator */ |
|
232
|
908 |
7069 |
if (suffix_size) suffix_size++; /* ^-- Ditto */ |
|
236
|
7 |
7977 |
if (b_stack_push(add_to_prefix? prefix_items: suffix_items, item) == NULL) { |
|
|
0 |
7984 |
if (b_stack_push(add_to_prefix? prefix_items: suffix_items, item) == NULL) { |
|
246
|
0 |
7069 |
if ((data->prefix = b_string_join("/", b_stack_reverse(prefix_items))) == NULL) { |
|
250
|
0 |
7069 |
if ((data->suffix = b_string_join("/", b_stack_reverse(suffix_items))) == NULL) { |
|
258
|
88 |
6981 |
if ((st->st_mode & S_IFMT) == S_IFDIR) { |
|
271
|
1227 |
5842 |
if (suffix_size > B_HEADER_SUFFIX_SIZE || prefix_size > B_HEADER_PREFIX_SIZE) { |
|
|
0 |
1227 |
if (suffix_size > B_HEADER_SUFFIX_SIZE || prefix_size > B_HEADER_PREFIX_SIZE) { |
|
302
|
6981 |
88 |
return (st->st_mode & S_IFMT) == S_IFREG && st->st_nlink > 1; |
|
|
404 |
6577 |
return (st->st_mode & S_IFMT) == S_IFREG && st->st_nlink > 1; |
|
310
|
0 |
7069 |
if ((ret = malloc(sizeof(*ret))) == NULL) { |
|
314
|
0 |
7069 |
if ((path_data = path_split(member_name, st)) == NULL) { |
|
324
|
6981 |
88 |
ret->size = (st->st_mode & S_IFMT) == S_IFREG? st->st_size: 0; |
|
335
|
0 |
7069 |
if ((st->st_mode & S_IFMT) == S_IFLNK) { |
|
336
|
0 |
0 |
if ((ret->linkdest = b_readlink(path, st)) == NULL) { |
|
339
|
404 |
6665 |
} else if (is_hardlink(st) && builder->hardlink_lookup) { |
|
|
404 |
0 |
} else if (is_hardlink(st) && builder->hardlink_lookup) { |
|
342
|
202 |
202 |
if (linkdest = builder->hardlink_lookup(builder->hardlink_cache, st->st_dev, st->st_ino, member_name)) { |
|
348
|
202 |
6867 |
if (ret->linkdest && b_string_len(ret->linkdest) > B_HEADER_LINKDEST_SIZE) { |
|
|
0 |
202 |
if (ret->linkdest && b_string_len(ret->linkdest) > B_HEADER_LINKDEST_SIZE) { |
|
382
|
0 |
7069 |
if (buf == NULL) { |
|
387
|
7069 |
0 |
if (err) { |
|
391
|
0 |
7069 |
if ((header = header_for_file(builder, path, member_name, st)) == NULL) { |
|
392
|
0 |
0 |
if (err) { |
|
404
|
7069 |
0 |
if (builder->user_lookup != NULL) { |
|
407
|
0 |
7069 |
if (builder->user_lookup(builder->user_cache, st->st_uid, st->st_gid, &user, &group) < 0) { |
|
408
|
0 |
0 |
if (err) { |
|
415
|
0 |
7069 |
if (b_header_set_usernames(header, user, group) < 0) { |
|
425
|
1227 |
5842 |
if (header->truncated || header->truncated_link) { |
|
|
0 |
1227 |
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 |
7065 |
if ((block = b_buffer_get_block(buf, B_HEADER_SIZE, &wrlen)) == NULL) { |
|
490
|
0 |
7065 |
if (b_header_encode_block(block, header) == NULL) { |
|
499
|
6775 |
290 |
if (B_HEADER_IS_IFREG(header) && fd > 0) { |
|
|
6775 |
0 |
if (B_HEADER_IS_IFREG(header) && fd > 0) { |
|
500
|
4 |
6771 |
if ((wrlen = b_file_write_contents(buf, fd, header->size)) < 0) { |
|
501
|
4 |
0 |
if (err) { |
|
529
|
0 |
92 |
if (builder == NULL) return; |
|
531
|
92 |
0 |
if (builder->buf) { |
|
536
|
92 |
0 |
if (builder->err) { |