Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/cadecoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ static inline bool CA_DECODER_IS_NAKED(CaDecoder *d) {

return d->n_nodes == 1 &&
!d->nodes[0].entry &&
(S_ISREG(d->nodes[0].mode) || S_ISBLK(d->nodes[0].mode));
(S_ISREG(d->nodes[0].mode) || S_ISBLK(d->nodes[0].mode) || S_ISCHR(d->nodes[0].mode));
}

static mode_t ca_decoder_node_mode(CaDecoderNode *n) {
Expand Down Expand Up @@ -481,13 +481,13 @@ int ca_decoder_set_base_fd(CaDecoder *d, int fd) {
if (fstatfs(fd, &sfs) < 0)
return -errno;

if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode) && !S_ISBLK(st.st_mode))
if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode) && !S_ISBLK(st.st_mode) && !S_ISCHR(st.st_mode))
return -ENOTTY;

d->nodes[0] = (CaDecoderNode) {
.fd = fd,
.entry_offset = S_ISDIR(st.st_mode) ? 0 : UINT64_MAX,
.payload_offset = S_ISREG(st.st_mode) || S_ISBLK(st.st_mode) ? 0 : UINT64_MAX,
.payload_offset = S_ISREG(st.st_mode) || S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode) ? 0 : UINT64_MAX,
.goodbye_offset = UINT64_MAX,
.end_offset = UINT64_MAX,
.mode = st.st_mode,
Expand Down Expand Up @@ -4112,7 +4112,7 @@ static int ca_decoder_step_node(CaDecoder *d, CaDecoderNode *n) {
if (mode == (mode_t) -1)
return -EUNATCH;

assert(S_ISREG(mode) || S_ISBLK(mode));
assert(S_ISREG(mode) || S_ISBLK(mode) || S_ISCHR(mode));

/* If the size of this payload is known, and we reached it, we are done */
if (n->size != UINT64_MAX) {
Expand Down
6 changes: 3 additions & 3 deletions src/casync-tool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1575,16 +1575,16 @@ static int verb_extract(int argc, char *argv[]) {
return -EINVAL;
}

} else if (S_ISREG(st.st_mode) || S_ISBLK(st.st_mode)) {
} else if (S_ISREG(st.st_mode) || S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode)) {

if (operation == _EXTRACT_OPERATION_INVALID)
operation = EXTRACT_BLOB_INDEX;
else if (operation != EXTRACT_BLOB_INDEX) {
log_error("Output is a regular file or block device, but attempted to extract an archive.");
log_error("Output is a regular file, block or character device, but attempted to extract an archive.");
return -EINVAL;
}
} else {
log_error("Output is neither a directory, a regular file, nor a block device. Refusing.");
log_error("Output is neither a directory, a regular file, nor a block or character device. Refusing.");
return -EINVAL;
}
}
Expand Down