version 1.2, 2019/02/10 23:24:14 |
version 1.3, 2019/02/11 19:18:36 |
|
|
*/ |
*/ |
|
|
if (DOWNLOAD_READ_NEXT == p->state) { |
if (DOWNLOAD_READ_NEXT == p->state) { |
if ( ! io_read_int(sess, p->fdin, &idx)) { |
if (!io_read_int(sess, p->fdin, &idx)) { |
ERRX1(sess, "io_read_int"); |
ERRX1(sess, "io_read_int"); |
return -1; |
return -1; |
} else if (idx >= 0 && (size_t)idx >= p->flsz) { |
} else if (idx >= 0 && (size_t)idx >= p->flsz) { |
|
|
*/ |
*/ |
|
|
download_reinit(sess, p, idx); |
download_reinit(sess, p, idx); |
if ( ! blk_send_ack(sess, p->fdin, &p->blk)) { |
if (!blk_send_ack(sess, p->fdin, &p->blk)) { |
ERRX1(sess, "blk_send_ack"); |
ERRX1(sess, "blk_send_ack"); |
goto out; |
goto out; |
} |
} |
|
|
-1 == fstat(p->ofd, &st)) { |
-1 == fstat(p->ofd, &st)) { |
ERR(sess, "%s: fstat", f->path); |
ERR(sess, "%s: fstat", f->path); |
goto out; |
goto out; |
} else if (-1 != p->ofd && ! S_ISREG(st.st_mode)) { |
} else if (-1 != p->ofd && !S_ISREG(st.st_mode)) { |
WARNX(sess, "%s: not regular", f->path); |
WARNX(sess, "%s: not regular", f->path); |
goto out; |
goto out; |
} |
} |
|
|
* or specifically told with -p. |
* or specifically told with -p. |
*/ |
*/ |
|
|
if ( ! sess->opts->preserve_perms) |
if (!sess->opts->preserve_perms) |
perm = -1 == p->ofd ? f->st.mode : st.st_mode; |
perm = -1 == p->ofd ? f->st.mode : st.st_mode; |
else |
else |
perm = f->st.mode; |
perm = f->st.mode; |
|
|
assert(-1 != p->fd); |
assert(-1 != p->fd); |
assert(-1 != p->fdin); |
assert(-1 != p->fdin); |
|
|
if ( ! io_read_int(sess, p->fdin, &rawtok)) { |
if (!io_read_int(sess, p->fdin, &rawtok)) { |
ERRX1(sess, "io_read_int"); |
ERRX1(sess, "io_read_int"); |
goto out; |
goto out; |
} |
} |
|
|
ERR(sess, "realloc"); |
ERR(sess, "realloc"); |
goto out; |
goto out; |
} |
} |
if ( ! io_read_buf(sess, p->fdin, buf, sz)) { |
if (!io_read_buf(sess, p->fdin, buf, sz)) { |
ERRX1(sess, "io_read_int"); |
ERRX1(sess, "io_read_int"); |
goto out; |
goto out; |
} else if ( ! buf_copy(sess, buf, sz, p)) { |
} else if (!buf_copy(sess, buf, sz, p)) { |
ERRX1(sess, "buf_copy"); |
ERRX1(sess, "buf_copy"); |
goto out; |
goto out; |
} |
} |
|
|
*/ |
*/ |
|
|
assert(MAP_FAILED != p->map); |
assert(MAP_FAILED != p->map); |
if ( ! buf_copy(sess, buf, sz, p)) { |
if (!buf_copy(sess, buf, sz, p)) { |
ERRX1(sess, "buf_copy"); |
ERRX1(sess, "buf_copy"); |
goto out; |
goto out; |
} |
} |
|
|
return 1; |
return 1; |
} |
} |
|
|
if ( ! buf_copy(sess, NULL, 0, p)) { |
if (!buf_copy(sess, NULL, 0, p)) { |
ERRX1(sess, "buf_copy"); |
ERRX1(sess, "buf_copy"); |
goto out; |
goto out; |
} |
} |
|
|
|
|
MD4_Final(ourmd, &p->ctx); |
MD4_Final(ourmd, &p->ctx); |
|
|
if ( ! io_read_buf(sess, p->fdin, md, MD4_DIGEST_LENGTH)) { |
if (!io_read_buf(sess, p->fdin, md, MD4_DIGEST_LENGTH)) { |
ERRX1(sess, "io_read_buf"); |
ERRX1(sess, "io_read_buf"); |
goto out; |
goto out; |
} else if (memcmp(md, ourmd, MD4_DIGEST_LENGTH)) { |
} else if (memcmp(md, ourmd, MD4_DIGEST_LENGTH)) { |