examples: Check return values of write.
Этот коммит содержится в:
родитель
8f850585dd
Коммит
9e40e60bc4
@ -125,8 +125,14 @@ static void select_loop(ssh_session session,ssh_channel channel){
|
|||||||
|
|
||||||
channel_free(channel);
|
channel_free(channel);
|
||||||
channel=channels[0]=NULL;
|
channel=channels[0]=NULL;
|
||||||
} else
|
} else {
|
||||||
write(1,buffer,lus);
|
ret = write(1, buffer, lus);
|
||||||
|
if (ret < 0) {
|
||||||
|
fprintf(stderr, "Error writing to stdin: %s",
|
||||||
|
strerror(errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while(channel && channel_is_open(channel) && channel_poll(channel,1)){ /* stderr */
|
while(channel && channel_is_open(channel) && channel_poll(channel,1)){ /* stderr */
|
||||||
lus=channel_read(channel,buffer,sizeof(buffer),1);
|
lus=channel_read(channel,buffer,sizeof(buffer),1);
|
||||||
@ -141,7 +147,12 @@ static void select_loop(ssh_session session,ssh_channel channel){
|
|||||||
channel_free(channel);
|
channel_free(channel);
|
||||||
channel=channels[0]=NULL;
|
channel=channels[0]=NULL;
|
||||||
} else
|
} else
|
||||||
write(2,buffer,lus);
|
ret = write(2, buffer, lus);
|
||||||
|
if (ret < 0) {
|
||||||
|
fprintf(stderr, "Error writing to stderr: %s",
|
||||||
|
strerror(errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(channel && channel_is_closed(channel)){
|
if(channel && channel_is_closed(channel)){
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user