Branch Coverage

marshal.c
Criterion Covered Total %
branch 17 76 22.3


line true false branch
76 2 63 for (i = 0; i < xattr_count; i++) {
82 0 63 if (!buf) return -1;
86 63 0 if (path_len) memcpy(p, path, path_len);
91 63 0 if (content_len) memcpy(p, content, content_len);
99 61 2 put_u32(p, (uint32_t)(apply_xattrs ? 1 : 0)); p += 4;
102 2 63 for (i = 0; i < xattr_count; i++) {
104 2 0 if (xattrs[i].key_len) memcpy(p, xattrs[i].key, xattrs[i].key_len);
108 2 0 if (xattrs[i].value_len) memcpy(p, xattrs[i].value, xattrs[i].value_len);
125 126 126 while (put < len) {
127 0 126 if (w < 0) {
128 0 0 if (errno == EINTR) continue;
131 0 126 if (w == 0) { errno = EIO; return -1; }
141 0 0 while (got < len) {
143 0 0 if (n < 0) {
144 0 0 if (errno == EINTR) continue;
147 0 0 if (n == 0) return (int)got; /* EOF */
158 0 63 if (write_full(fd, hdr, 4) < 0) return -1;
159 0 63 if (write_full(fd, payload, payload_len) < 0) return -1;
174 0 0 if (n == 0) return 1; /* clean EOF */
175 0 0 if (n < 4) return -1; /* truncated header */
178 0 0 if (total == 0 || total > MARSHAL_MAX_RECORD) return -1;
0 0 if (total == 0 || total > MARSHAL_MAX_RECORD) return -1;
181 0 0 if (!arena) return -1;
184 0 0 if (n != (int)total) { free(arena); return -1; }
194 0 0 if (p + 4 > end) goto bad;
196 0 0 if (p + out->path_len + 1 > end) goto bad;
201 0 0 if (p + 4 > end) goto bad;
203 0 0 if (p + out->content_len > end) goto bad;
208 0 0 if (p + 4 + 8 + 4 + 4 + 4 + 4 + 4 > end) goto bad;
217 0 0 if (out->xattr_count > 0) {
218 0 0 if (out->xattr_count > MARSHAL_MAX_RECORD / sizeof(ArchiveXattr)) goto bad;
220 0 0 if (!out->xattrs) goto bad;
222 0 0 for (i = 0; i < out->xattr_count; i++) {
223 0 0 if (p + 4 > end) goto bad;
225 0 0 if (p + out->xattrs[i].key_len + 1 > end) goto bad;
228 0 0 if (p + 4 > end) goto bad;
230 0 0 if (p + out->xattrs[i].value_len > end) goto bad;
248 0 0 if (!j) return;