Skip to content

Commit

Permalink
scp.c: improved and streamlined formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mback2k committed Mar 23, 2015
1 parent 1e7988c commit 2d59b41
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/scp.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,16 +295,17 @@ scp_recv(LIBSSH2_SESSION * session, const char *path, struct stat * sb)
}

snprintf((char *)session->scpRecv_command,
session->scpRecv_command_len, "scp -%sf ", sb?"p":"");
session->scpRecv_command_len,
"scp -%sf ", sb?"p":"");

cmd_len = strlen((char *)session->scpRecv_command);

memset(&session->scpRecv_command[cmd_len], 0,
session->scpRecv_command_len - cmd_len);

(void) shell_quotearg(path,
&session->scpRecv_command[cmd_len],
session->scpRecv_command_len - cmd_len);
(void)shell_quotearg(path,
&session->scpRecv_command[cmd_len],
session->scpRecv_command_len - cmd_len);

session->scpRecv_command[session->scpRecv_command_len - 1] = '\0';

Expand Down Expand Up @@ -797,13 +798,16 @@ scp_send(LIBSSH2_SESSION * session, const char *path, int mode,

session->scpSend_command =
LIBSSH2_ALLOC(session, session->scpSend_command_len);

if (!session->scpSend_command) {
_libssh2_error(session, LIBSSH2_ERROR_ALLOC,
"Unable to allocate a command buffer for scp session");
"Unable to allocate a command buffer for "
"SCP session");
return NULL;
}

snprintf((char *)session->scpSend_command, session->scpSend_command_len,
snprintf((char *)session->scpSend_command,
session->scpSend_command_len,
"scp -%st ", (mtime || atime)?"p":"");

cmd_len = strlen((char *)session->scpSend_command);
Expand Down

0 comments on commit 2d59b41

Please sign in to comment.