Piotr Jurkiewicz
2016-Apr-07 01:54 UTC
[PATCH 2/2] More consistent upload args and error messages in sftp client
This patch changes the name of `resume` argument in upload related functions to `resume_flag`, to make it consistent with a similar argument in download related functions. It also changes recursive upload error message to be consistent with a similar error message during recursive download. Signed-off-by: Piotr Jurkiewicz <piotr.jerzy.jurkiewicz at gmail.com> --- sftp-client.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sftp-client.c b/sftp-client.c index ee4d131..be69acb 100644 --- a/sftp-client.c +++ b/sftp-client.c @@ -1549,7 +1549,7 @@ download_dir(struct sftp_conn *conn, const char *src, const char *dst, int do_upload(struct sftp_conn *conn, const char *local_path, - const char *remote_path, int preserve_flag, int resume, int fsync_flag) + const char *remote_path, int preserve_flag, int resume_flag, int fsync_flag) { int r, local_fd; u_int status = SSH2_FX_OK; @@ -1599,7 +1599,7 @@ do_upload(struct sftp_conn *conn, const char *local_path, a.flags &= ~SSH2_FILEXFER_ATTR_ACMODTIME; offset = 0; - if (resume) { + if (resume_flag) { /* Get remote file size if it exists */ if ((c = do_stat(conn, remote_path, 1)) != NULL) { if ((off_t)c->size > sb.st_size) { @@ -1771,7 +1771,8 @@ do_upload(struct sftp_conn *conn, const char *local_path, static int upload_dir_internal(struct sftp_conn *conn, const char *src, const char *dst, - int depth, int preserve_flag, int print_flag, int resume, int fsync_flag) + int depth, int preserve_flag, int print_flag, int resume_flag, + int fsync_flag) { int ret = 0; DIR *dirp; @@ -1841,13 +1842,13 @@ upload_dir_internal(struct sftp_conn *conn, const char *src, const char *dst, continue; if (upload_dir_internal(conn, new_src, new_dst, - depth + 1, preserve_flag, print_flag, resume, + depth + 1, preserve_flag, print_flag, resume_flag, fsync_flag) == -1) ret = -1; } else if (S_ISREG(sb.st_mode)) { if (do_upload(conn, new_src, new_dst, - preserve_flag, resume, fsync_flag) == -1) { - error("Uploading of file %s to %s failed!", + preserve_flag, resume_flag, fsync_flag) == -1) { + error("Upload of file %s to %s failed", new_src, new_dst); ret = -1; } @@ -1865,7 +1866,7 @@ upload_dir_internal(struct sftp_conn *conn, const char *src, const char *dst, int upload_dir(struct sftp_conn *conn, const char *src, const char *dst, - int preserve_flag, int print_flag, int resume, int fsync_flag) + int preserve_flag, int print_flag, int resume_flag, int fsync_flag) { char *dst_canon; int ret; @@ -1876,7 +1877,7 @@ upload_dir(struct sftp_conn *conn, const char *src, const char *dst, } ret = upload_dir_internal(conn, src, dst_canon, 0, preserve_flag, - print_flag, resume, fsync_flag); + print_flag, resume_flag, fsync_flag); free(dst_canon); return ret; -- 2.1.4