| line |
true |
false |
branch |
|
55
|
29 |
0 |
if (!plugin || !plugin->name || !*plugin->name) return -1; |
|
|
29 |
0 |
if (!plugin || !plugin->name || !*plugin->name) return -1; |
|
|
0 |
29 |
if (!plugin || !plugin->name || !*plugin->name) return -1; |
|
56
|
0 |
29 |
if (g_plugin_count >= MAX_ARCHIVE_PLUGINS) return -1; |
|
58
|
0 |
29 |
for (i = 0; i < g_plugin_count; i++) { |
|
59
|
0 |
0 |
if (strcmp(g_plugins[i]->name, plugin->name) == 0) return 0; |
|
69
|
0 |
0 |
if (!name) return 0; |
|
70
|
0 |
0 |
for (i = 0; i < g_plugin_count; i++) { |
|
71
|
0 |
0 |
if (strcmp(g_plugins[i]->name, name) == 0) { |
|
72
|
0 |
0 |
for (j = i + 1; j < g_plugin_count; j++) { |
|
86
|
0 |
109 |
if (!name) return NULL; |
|
87
|
109 |
1 |
for (i = 0; i < g_plugin_count; i++) { |
|
88
|
108 |
1 |
if (strcmp(g_plugins[i]->name, name) == 0) return g_plugins[i]; |
|
98
|
0 |
0 |
for (i = 0; i < g_plugin_count; i++) { |
|
99
|
0 |
0 |
if (!g_plugins[i]->probe) continue; |
|
101
|
0 |
0 |
if (score > best_score) { |
|
118
|
2764 |
2761 |
while ((size_t)total < len) { |
|
120
|
0 |
2764 |
if (n < 0) { |
|
121
|
0 |
0 |
if (errno == EINTR) continue; |
|
124
|
2 |
2762 |
if (n == 0) break; /* EOF */ |
|
135
|
2147 |
2147 |
while (total < len) { |
|
137
|
0 |
2147 |
if (n < 0) { |
|
138
|
0 |
0 |
if (errno == EINTR) continue; |
|
154
|
0 |
0 |
size_t avail = (s->pos < s->len) ? (s->len - s->pos) : 0; |
|
156
|
0 |
0 |
if (take) memcpy(buf, s->buf + s->pos, take); |
|
172
|
0 |
0 |
if (s->buf) free(s->buf); |
|
182
|
0 |
0 |
if (s->len + len > s->cap) { |
|
183
|
0 |
0 |
size_t want = s->cap ? s->cap * 2 : 4096; |
|
184
|
0 |
0 |
while (want < s->len + len) want *= 2; |
|
186
|
0 |
0 |
if (!p) return -1; |
|
213
|
0 |
8 |
if (!s) return NULL; |
|
215
|
8 |
0 |
s->raw_cap = chunk_size ? chunk_size : ARCHIVE_DEFAULT_CHUNK; |
|
217
|
0 |
8 |
if (!s->raw) { free(s); return NULL; } |
|
218
|
0 |
8 |
if (inflateInit2(&s->zs, MAX_WBITS | 32) != Z_OK) { |
|
230
|
0 |
8 |
if (!s) return; |
|
231
|
8 |
0 |
if (s->zs_inited) inflateEnd(&s->zs); |
|
240
|
0 |
127 |
if (s->stream_end) return 0; |
|
245
|
207 |
121 |
while (s->zs.avail_out > 0) { |
|
246
|
88 |
119 |
if (s->zs.avail_in == 0 && !s->eof) { |
|
|
88 |
0 |
if (s->zs.avail_in == 0 && !s->eof) { |
|
248
|
0 |
88 |
if (n < 0) { |
|
249
|
0 |
0 |
if (errno == EINTR) continue; |
|
252
|
0 |
88 |
if (n == 0) { |
|
260
|
0 |
207 |
int rc = inflate(&s->zs, s->eof ? Z_FINISH : Z_NO_FLUSH); |
|
261
|
5 |
202 |
if (rc == Z_STREAM_END) { |
|
265
|
0 |
202 |
if (rc == Z_BUF_ERROR && s->eof && s->zs.avail_in == 0) { |
|
|
0 |
0 |
if (rc == Z_BUF_ERROR && s->eof && s->zs.avail_in == 0) { |
|
|
0 |
0 |
if (rc == Z_BUF_ERROR && s->eof && s->zs.avail_in == 0) { |
|
268
|
1 |
201 |
if (rc != Z_OK && rc != Z_BUF_ERROR) return -1; |
|
|
1 |
0 |
if (rc != Z_OK && rc != Z_BUF_ERROR) return -1; |
|
290
|
0 |
4 |
if (!s) return NULL; |
|
292
|
4 |
0 |
s->out_cap = chunk_size ? chunk_size : ARCHIVE_DEFAULT_CHUNK; |
|
294
|
0 |
4 |
if (!s->out) { free(s); return NULL; } |
|
295
|
4 |
0 |
if (level < 0 || level > 9) level = 6; |
|
|
0 |
4 |
if (level < 0 || level > 9) level = 6; |
|
296
|
0 |
4 |
if (deflateInit2(&s->zs, level, Z_DEFLATED, MAX_WBITS | 16, 8, |
|
309
|
4 |
22 |
int flush = finish ? Z_FINISH : Z_NO_FLUSH; |
|
315
|
88 |
17 |
if (produced) { |
|
317
|
0 |
88 |
if (archive_push_fd(&fdst, s->out, produced) < 0) return -1; |
|
319
|
4 |
101 |
if (rc == Z_STREAM_END) return 0; |
|
320
|
0 |
101 |
if (rc != Z_OK) return -1; |
|
321
|
101 |
0 |
if (!finish && s->zs.avail_in == 0) return 0; |
|
|
22 |
79 |
if (!finish && s->zs.avail_in == 0) return 0; |
|
331
|
0 |
22 |
if (gz_sink_drain(s, 0) < 0) return -1; |
|
346
|
0 |
4 |
if (!s) return; |
|
347
|
4 |
0 |
if (s->zs_inited) deflateEnd(&s->zs); |
|
359
|
0 |
0 |
if (!xattrs || !n) return 0; |
|
|
0 |
0 |
if (!xattrs || !n) return 0; |
|
362
|
0 |
0 |
for (i = 0; i < n; i++) { |
|
364
|
0 |
0 |
if (xattrs[i].key_len >= sizeof keybuf) { errno = ENAMETOOLONG; return -1; } |
|
370
|
0 |
0 |
if (fsetxattr(fd, keybuf, xattrs[i].value, xattrs[i].value_len, 0) < 0) return -1; |