mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-10 18:28:10 +09:00
misc: Reformat ssh_path_expand_escape
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Pavol Žáčik <pzacik@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
20
src/misc.c
20
src/misc.c
@@ -1282,8 +1282,7 @@ char *ssh_path_expand_escape(ssh_session session, const char *s)
|
||||
if (session->opts.sshdir) {
|
||||
x = strdup(session->opts.sshdir);
|
||||
} else {
|
||||
ssh_set_error(session, SSH_FATAL,
|
||||
"Cannot expand sshdir");
|
||||
ssh_set_error(session, SSH_FATAL, "Cannot expand sshdir");
|
||||
free(buf);
|
||||
free(r);
|
||||
return NULL;
|
||||
@@ -1301,8 +1300,7 @@ char *ssh_path_expand_escape(ssh_session session, const char *s)
|
||||
if (session->opts.host) {
|
||||
x = strdup(session->opts.host);
|
||||
} else {
|
||||
ssh_set_error(session, SSH_FATAL,
|
||||
"Cannot expand host");
|
||||
ssh_set_error(session, SSH_FATAL, "Cannot expand host");
|
||||
free(buf);
|
||||
free(r);
|
||||
return NULL;
|
||||
@@ -1312,25 +1310,24 @@ char *ssh_path_expand_escape(ssh_session session, const char *s)
|
||||
if (session->opts.username) {
|
||||
x = strdup(session->opts.username);
|
||||
} else {
|
||||
ssh_set_error(session, SSH_FATAL,
|
||||
"Cannot expand username");
|
||||
ssh_set_error(session, SSH_FATAL, "Cannot expand username");
|
||||
free(buf);
|
||||
free(r);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case 'p':
|
||||
{
|
||||
case 'p': {
|
||||
char tmp[6];
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "%hu",
|
||||
(uint16_t)(session->opts.port > 0 ? session->opts.port
|
||||
: 22));
|
||||
x = strdup(tmp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ssh_set_error(session, SSH_FATAL,
|
||||
ssh_set_error(session,
|
||||
SSH_FATAL,
|
||||
"Wrong escape sequence detected");
|
||||
free(buf);
|
||||
free(r);
|
||||
@@ -1346,8 +1343,7 @@ char *ssh_path_expand_escape(ssh_session session, const char *s)
|
||||
|
||||
i += strlen(x);
|
||||
if (i >= MAX_BUF_SIZE) {
|
||||
ssh_set_error(session, SSH_FATAL,
|
||||
"String too long");
|
||||
ssh_set_error(session, SSH_FATAL, "String too long");
|
||||
free(buf);
|
||||
free(x);
|
||||
free(r);
|
||||
|
||||
Reference in New Issue
Block a user