mirror of
https://github.com/upa/mscp.git
synced 2026-05-13 22:07:29 +08:00
fix uninitialized dst_path_is_dir bool
This commit is contained in:
@@ -376,6 +376,8 @@ int main(int argc, char **argv)
|
|||||||
fprintf(stderr, "%s\n", mscp_get_error());
|
fprintf(stderr, "%s\n", mscp_get_error());
|
||||||
|
|
||||||
ret = mscp_join(m);
|
ret = mscp_join(m);
|
||||||
|
if (ret != 0)
|
||||||
|
fprintf(stderr, "%s\n", mscp_get_error());
|
||||||
|
|
||||||
pthread_cancel(tid_stat);
|
pthread_cancel(tid_stat);
|
||||||
pthread_join(tid_stat, NULL);
|
pthread_join(tid_stat, NULL);
|
||||||
|
|||||||
10
src/mscp.c
10
src/mscp.c
@@ -289,12 +289,14 @@ int mscp_set_dst_path(struct mscp *m, const char *dst_path)
|
|||||||
int mscp_prepare(struct mscp *m)
|
int mscp_prepare(struct mscp *m)
|
||||||
{
|
{
|
||||||
sftp_session src_sftp = NULL, dst_sftp = NULL;
|
sftp_session src_sftp = NULL, dst_sftp = NULL;
|
||||||
bool src_path_is_dir, dst_path_is_dir, dst_path_should_dir = false;
|
bool src_path_is_dir, dst_path_is_dir, dst_path_should_dir;
|
||||||
struct list_head tmp;
|
struct list_head tmp;
|
||||||
struct path *p;
|
struct path *p;
|
||||||
struct src *s;
|
struct src *s;
|
||||||
mstat ss, ds;
|
mstat ss, ds;
|
||||||
|
|
||||||
|
src_path_is_dir = dst_path_is_dir = dst_path_should_dir = false;
|
||||||
|
|
||||||
switch (m->opts->direction) {
|
switch (m->opts->direction) {
|
||||||
case MSCP_DIRECTION_L2R:
|
case MSCP_DIRECTION_L2R:
|
||||||
src_sftp = NULL;
|
src_sftp = NULL;
|
||||||
@@ -316,8 +318,7 @@ int mscp_prepare(struct mscp *m)
|
|||||||
if (mstat_is_dir(ds))
|
if (mstat_is_dir(ds))
|
||||||
dst_path_is_dir = true;
|
dst_path_is_dir = true;
|
||||||
mscp_stat_free(ds);
|
mscp_stat_free(ds);
|
||||||
} else
|
}
|
||||||
dst_path_is_dir = false;
|
|
||||||
|
|
||||||
/* walk a src_path recusively, and resolve path->dst_path for each src */
|
/* walk a src_path recusively, and resolve path->dst_path for each src */
|
||||||
list_for_each_entry(s, &m->src_list, list) {
|
list_for_each_entry(s, &m->src_list, list) {
|
||||||
@@ -438,6 +439,9 @@ int mscp_join(struct mscp *m)
|
|||||||
if (m->threads) {
|
if (m->threads) {
|
||||||
for (n = 0; n < m->opts->nr_threads; n++) {
|
for (n = 0; n < m->opts->nr_threads; n++) {
|
||||||
struct mscp_thread *t = &m->threads[n];
|
struct mscp_thread *t = &m->threads[n];
|
||||||
|
if (t->ret != 0)
|
||||||
|
ret = ret;
|
||||||
|
|
||||||
if (t->sftp) {
|
if (t->sftp) {
|
||||||
ssh_sftp_close(t->sftp);
|
ssh_sftp_close(t->sftp);
|
||||||
t->sftp = NULL;
|
t->sftp = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user