version 1.2, 2019/02/10 23:24:14 |
version 1.3, 2019/02/10 23:56:19 |
|
|
new[j++] = *f; |
new[j++] = *f; |
i++; |
i++; |
WARNX(sess, "%s: duplicate path: %s", |
WARNX(sess, "%s: duplicate path: %s", |
f->wpath, f->path); |
f->wpath, f->path); |
free(fnext->path); |
free(fnext->path); |
free(fnext->link); |
free(fnext->link); |
fnext->path = fnext->link = NULL; |
fnext->path = fnext->link = NULL; |
|
|
} |
} |
|
|
ERRX(sess, "%s: duplicate working path for " |
ERRX(sess, "%s: duplicate working path for " |
"possibly different file: %s, %s", |
"possibly different file: %s, %s", |
f->wpath, f->path, fnext->path); |
f->wpath, f->path, fnext->path); |
free(new); |
free(new); |
return 0; |
return 0; |
} |
} |
|
|
static void |
static void |
flist_copy_stat(struct flist *f, const struct stat *st) |
flist_copy_stat(struct flist *f, const struct stat *st) |
{ |
{ |
|
|
f->st.mode = st->st_mode; |
f->st.mode = st->st_mode; |
f->st.uid = st->st_uid; |
f->st.uid = st->st_uid; |
f->st.gid = st->st_gid; |
f->st.gid = st->st_gid; |
|
|
* Return zero on failure, non-zero on success. |
* Return zero on failure, non-zero on success. |
*/ |
*/ |
int |
int |
flist_send(struct sess *sess, int fdin, |
flist_send(struct sess *sess, int fdin, int fdout, const struct flist *fl, |
int fdout, const struct flist *fl, size_t flsz) |
size_t flsz) |
{ |
{ |
size_t i, fnlen; |
size_t i, fnlen; |
uint8_t flag; |
uint8_t flag; |
|
|
* Returns zero on failure, non-zero on success. |
* Returns zero on failure, non-zero on success. |
*/ |
*/ |
static int |
static int |
flist_recv_name(struct sess *sess, int fd, |
flist_recv_name(struct sess *sess, int fd, struct flist *f, uint8_t flags, |
struct flist *f, uint8_t flags, char last[MAXPATHLEN]) |
char last[MAXPATHLEN]) |
{ |
{ |
uint8_t bval; |
uint8_t bval; |
size_t partial = 0; |
size_t partial = 0; |
|
|
* Returns zero on failure, non-zero on success. |
* Returns zero on failure, non-zero on success. |
*/ |
*/ |
static int |
static int |
flist_realloc(struct sess *sess, |
flist_realloc(struct sess *sess, struct flist **fl, size_t *sz, size_t *max) |
struct flist **fl, size_t *sz, size_t *max) |
|
{ |
{ |
void *pp; |
void *pp; |
|
|
|
|
* Returns zero on failure, non-zero on success. |
* Returns zero on failure, non-zero on success. |
*/ |
*/ |
static int |
static int |
flist_append(struct sess *sess, struct flist *f, |
flist_append(struct sess *sess, struct flist *f, struct stat *st, |
struct stat *st, const char *path) |
const char *path) |
{ |
{ |
|
|
/* |
/* |
|
|
* Returns zero on failure, non-zero on success. |
* Returns zero on failure, non-zero on success. |
*/ |
*/ |
static int |
static int |
flist_gen_dirent(struct sess *sess, char *root, |
flist_gen_dirent(struct sess *sess, char *root, struct flist **fl, size_t *sz, |
struct flist **fl, size_t *sz, size_t *max) |
size_t *max) |
{ |
{ |
char *cargv[2], *cp; |
char *cargv[2], *cp; |
int rc = 0; |
int rc = 0; |
|
|
* Returns zero on failure, non-zero on success. |
* Returns zero on failure, non-zero on success. |
*/ |
*/ |
static int |
static int |
flist_gen_dirs(struct sess *sess, size_t argc, |
flist_gen_dirs(struct sess *sess, size_t argc, char **argv, struct flist **flp, |
char **argv, struct flist **flp, size_t *sz) |
size_t *sz) |
{ |
{ |
size_t i, max = 0; |
size_t i, max = 0; |
|
|
|
|
* Returns zero on failure, non-zero on success. |
* Returns zero on failure, non-zero on success. |
*/ |
*/ |
static int |
static int |
flist_gen_files(struct sess *sess, size_t argc, |
flist_gen_files(struct sess *sess, size_t argc, char **argv, |
char **argv, struct flist **flp, size_t *sz) |
struct flist **flp, size_t *sz) |
{ |
{ |
struct flist *fl = NULL, *f; |
struct flist *fl = NULL, *f; |
size_t i, flsz = 0; |
size_t i, flsz = 0; |
|
|
continue; |
continue; |
} |
} |
|
|
|
|
f = &fl[flsz++]; |
f = &fl[flsz++]; |
assert(NULL != f); |
assert(NULL != f); |
|
|
|
|
* On success, "fl" will need to be freed with flist_free(). |
* On success, "fl" will need to be freed with flist_free(). |
*/ |
*/ |
int |
int |
flist_gen(struct sess *sess, size_t argc, |
flist_gen(struct sess *sess, size_t argc, char **argv, struct flist **flp, |
char **argv, struct flist **flp, size_t *sz) |
size_t *sz) |
{ |
{ |
int rc; |
int rc; |
|
|
|
|
* On success, "fl" will need to be freed with flist_free(). |
* On success, "fl" will need to be freed with flist_free(). |
*/ |
*/ |
int |
int |
flist_gen_dels(struct sess *sess, const char *root, |
flist_gen_dels(struct sess *sess, const char *root, struct flist **fl, |
struct flist **fl, size_t *sz, |
size_t *sz, const struct flist *wfl, size_t wflsz) |
const struct flist *wfl, size_t wflsz) |
|
{ |
{ |
char **cargv = NULL; |
char **cargv = NULL; |
int rc = 0, c; |
int rc = 0, c; |
|
|
* Return zero on failure, non-zero on success. |
* Return zero on failure, non-zero on success. |
*/ |
*/ |
int |
int |
flist_del(struct sess *sess, int root, |
flist_del(struct sess *sess, int root, const struct flist *fl, size_t flsz) |
const struct flist *fl, size_t flsz) |
|
{ |
{ |
ssize_t i; |
ssize_t i; |
int flag; |
int flag; |