1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-07-31 00:03:07 +03:00

examples: Fix PTY allocation error.

This commit is contained in:
Anthony VEREZ
2012-01-30 09:48:01 +01:00
committed by Andreas Schneider
parent 31727bf33a
commit 9e5b3914de

View File

@ -270,7 +270,8 @@ int main(int argc, char **argv){
do {
message=ssh_message_get(session);
if(message && ssh_message_type(message)==SSH_REQUEST_CHANNEL &&
ssh_message_subtype(message)==SSH_CHANNEL_REQUEST_SHELL){
(ssh_message_subtype(message)==SSH_CHANNEL_REQUEST_SHELL ||
ssh_message_subtype(message)==SSH_CHANNEL_REQUEST_PTY)) {
// if(!strcmp(ssh_message_channel_request_subsystem(message),"sftp")){
sftp=1;
ssh_message_channel_request_reply_success(message);
@ -295,6 +296,10 @@ int main(int argc, char **argv){
printf("error writing to buffer\n");
return 1;
}
if (buf[0] == '\x0d') {
write(1, "\n", 1);
ssh_channel_write(chan, "\n", 1);
}
}
} while (i>0);
ssh_disconnect(session);