version 1.21, 2019/05/08 20:00:25 |
version 1.22, 2019/05/08 21:30:11 |
|
|
*/ |
*/ |
|
|
if (rc != -1) { |
if (rc != -1) { |
b = symlinkat_read(sess, p->rootfd, f->path); |
b = symlinkat_read(p->rootfd, f->path); |
if (b == NULL) { |
if (b == NULL) { |
ERRX1("symlinkat_read"); |
ERRX1("symlinkat_read"); |
return -1; |
return -1; |
|
|
|
|
if (rc == -1 || updatelink) { |
if (rc == -1 || updatelink) { |
LOG3("%s: creating symlink: %s", f->path, f->link); |
LOG3("%s: creating symlink: %s", f->path, f->link); |
if (mktemplate(sess, &temp, |
if (mktemplate(&temp, f->path, sess->opts->recursive) == -1) { |
f->path, sess->opts->recursive) == -1) { |
|
ERRX1("mktemplate"); |
ERRX1("mktemplate"); |
return -1; |
return -1; |
} |
} |
|
|
|
|
if (rc == -1 || updatedev) { |
if (rc == -1 || updatedev) { |
newdev = 1; |
newdev = 1; |
if (mktemplate(sess, &temp, f->path, |
if (mktemplate(&temp, f->path, sess->opts->recursive) == -1) { |
sess->opts->recursive) == -1) { |
|
ERRX1("mktemplate"); |
ERRX1("mktemplate"); |
return -1; |
return -1; |
} |
} |
|
|
} |
} |
|
|
rsync_set_metadata_at(sess, newdev, |
rsync_set_metadata_at(sess, newdev, |
p->rootfd, f, newdev ? temp : f->path); |
p->rootfd, f, newdev ? temp : f->path); |
|
|
if (newdev) { |
if (newdev) { |
if (renameat(p->rootfd, temp, p->rootfd, f->path) == -1) { |
if (renameat(p->rootfd, temp, p->rootfd, f->path) == -1) { |
|
|
|
|
if (rc == -1) { |
if (rc == -1) { |
newfifo = 1; |
newfifo = 1; |
if (mktemplate(sess, &temp, f->path, |
if (mktemplate(&temp, f->path, sess->opts->recursive) == -1) { |
sess->opts->recursive) == -1) { |
|
ERRX1("mktemplate"); |
ERRX1("mktemplate"); |
return -1; |
return -1; |
} |
} |
|
|
|
|
if (rc == -1) { |
if (rc == -1) { |
newsock = 1; |
newsock = 1; |
if (mktemplate(sess, &temp, f->path, |
if (mktemplate(&temp, f->path, sess->opts->recursive) == -1) { |
sess->opts->recursive) == -1) { |
|
ERRX1("mktemplate"); |
ERRX1("mktemplate"); |
return -1; |
return -1; |
} |
} |
|
|
* On success, upload_free() must be called with the allocated pointer. |
* On success, upload_free() must be called with the allocated pointer. |
*/ |
*/ |
struct upload * |
struct upload * |
upload_alloc(struct sess *sess, const char *root, int rootfd, int fdout, |
upload_alloc(const char *root, int rootfd, int fdout, |
size_t clen, const struct flist *fl, size_t flsz, mode_t msk) |
size_t clen, const struct flist *fl, size_t flsz, mode_t msk) |
{ |
{ |
struct upload *p; |
struct upload *p; |
|
|
} |
} |
|
|
u->bufpos = pos = 0; |
u->bufpos = pos = 0; |
io_buffer_int(sess, u->buf, &pos, u->bufsz, u->idx); |
io_buffer_int(u->buf, &pos, u->bufsz, u->idx); |
io_buffer_int(sess, u->buf, &pos, u->bufsz, blk.blksz); |
io_buffer_int(u->buf, &pos, u->bufsz, blk.blksz); |
io_buffer_int(sess, u->buf, &pos, u->bufsz, blk.len); |
io_buffer_int(u->buf, &pos, u->bufsz, blk.len); |
io_buffer_int(sess, u->buf, &pos, u->bufsz, blk.csum); |
io_buffer_int(u->buf, &pos, u->bufsz, blk.csum); |
io_buffer_int(sess, u->buf, &pos, u->bufsz, blk.rem); |
io_buffer_int(u->buf, &pos, u->bufsz, blk.rem); |
for (i = 0; i < blk.blksz; i++) { |
for (i = 0; i < blk.blksz; i++) { |
io_buffer_int(sess, u->buf, &pos, u->bufsz, |
io_buffer_int(u->buf, &pos, u->bufsz, |
blk.blks[i].chksum_short); |
blk.blks[i].chksum_short); |
io_buffer_buf(sess, u->buf, &pos, u->bufsz, |
io_buffer_buf(u->buf, &pos, u->bufsz, |
blk.blks[i].chksum_long, blk.csum); |
blk.blks[i].chksum_long, blk.csum); |
} |
} |
assert(pos == u->bufsz); |
assert(pos == u->bufsz); |