diff options
author | Ryo Nakamura <upa@haeena.net> | 2022-10-31 22:51:39 +0900 |
---|---|---|
committer | Ryo Nakamura <upa@haeena.net> | 2022-10-31 22:51:39 +0900 |
commit | 926688e84921c0ba17c39b41b34bbcd391def299 (patch) | |
tree | 708d68dcda3e5afa9cf8aa9a87666460b80bd07f /src/main.c | |
parent | 77651305fdbe863b32989295ff630223f5fa7704 (diff) |
rename dirname if dst dir does not exist
`scp remote:srcdir dstdir` renames srcdir to dstdir if dstdir does
not exist. If dstdir exists, it creates dstdir/srcdir.
This commit imitates this behavior.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -259,7 +259,7 @@ int main(int argc, char **argv) break; case 'h': usage(true); - return 1; + return 0; default: usage(false); return 1; @@ -339,8 +339,10 @@ int main(int argc, char **argv) t->finished = false; pprint3("connecting to %s for a copy thread...\n", m.host); t->sftp = ssh_make_sftp_session(m.host, m.opts); - if (!t->sftp) + if (!t->sftp) { + ret = 1; goto join_out; + } } /* spawn count thread */ @@ -348,6 +350,7 @@ int main(int argc, char **argv) if (ret < 0) { pr_err("pthread_create error: %d\n", ret); stop_copy_threads(0); + ret = 1; goto join_out; } @@ -361,6 +364,7 @@ int main(int argc, char **argv) if (ret < 0) { pr_err("pthread_create error: %d\n", ret); stop_copy_threads(0); + ret = 1; goto join_out; } } |