summaryrefslogtreecommitdiffstats
path: root/loader2/telnet.c
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2005-03-02 01:38:30 +0000
committerPeter Jones <pjones@redhat.com>2005-03-02 01:38:30 +0000
commit71b98ebceedd9b12c9dc034941021ac1a942fc3c (patch)
tree04072bbc611bde199682b06cd439bea7b2675dbe /loader2/telnet.c
parentdbd6a4e1c3b3a218dafbf1845a82c86ce339c5fd (diff)
downloadanaconda-71b98ebceedd9b12c9dc034941021ac1a942fc3c.tar.gz
anaconda-71b98ebceedd9b12c9dc034941021ac1a942fc3c.tar.xz
anaconda-71b98ebceedd9b12c9dc034941021ac1a942fc3c.zip
Catch returns from read, write, and open
fix sign of addrLength for passing to socket() actually make sure beTelnet's ttys are ttyp0, which we've just opened.
Diffstat (limited to 'loader2/telnet.c')
-rw-r--r--loader2/telnet.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/loader2/telnet.c b/loader2/telnet.c
index fda836639..473acfeb4 100644
--- a/loader2/telnet.c
+++ b/loader2/telnet.c
@@ -77,30 +77,31 @@ telnet_negotiate(int socket, char ** term_type_ptr, int * heightPtr,
IAC DO NAWS
IAC SB TERMINAL_TYPE "\x01" IAC SE
;
+ int ret;
- write(socket, request, sizeof(request)-1);
+ ret = write(socket, request, sizeof(request)-1);
/* Read from the terminal until we get the terminal type. This will
do bad things if the client doesn't send the terminal type, but
those clients have existed for aeons (right?) */
do {
- read(socket, &ch, 1);
+ ret = read(socket, &ch, 1);
if (ch != '\xff') {
abort();
}
- read(socket, &ch, 1); /* command */
+ ret = read(socket, &ch, 1); /* command */
if (ch != '\xfa') {
- read(socket, &ch, 1); /* verb */
+ ret = read(socket, &ch, 1); /* verb */
continue;
}
- read(socket, &ch, 1); /* suboption */
+ ret = read(socket, &ch, 1); /* suboption */
if (ch == '\x18') {
state = ST_TERMTYPE;
- read(socket, &ch, 1); /* should be 0x0! */
+ ret = read(socket, &ch, 1); /* should be 0x0! */
done = 1;
} else if (ch == '\x1f') {
state = ST_WINDOWSIZE;
@@ -108,7 +109,7 @@ telnet_negotiate(int socket, char ** term_type_ptr, int * heightPtr,
state = ST_NONE;;
}
- read(socket, &ch, 1); /* data */
+ ret = read(socket, &ch, 1); /* data */
while (ch != '\xff') {
if (state == ST_TERMTYPE) {
if (termAlloced == termLength) {
@@ -122,10 +123,10 @@ telnet_negotiate(int socket, char ** term_type_ptr, int * heightPtr,
*sizePtr++ = ch;
}
- read(socket, &ch, 1); /* data */
+ ret = read(socket, &ch, 1); /* data */
}
- read(socket, &ch, 1); /* should be a SE */
+ ret = read(socket, &ch, 1); /* should be a SE */
} while (!done);
@@ -251,6 +252,7 @@ void
telnet_send_output(int sock, char *data, int len) {
char *s, *d; /* source, destination */
char *buf;
+ int ret;
buf = alloca((len*2)+1); /* max necessary size */
@@ -265,5 +267,5 @@ telnet_send_output(int sock, char *data, int len) {
}
/* now send it... */
- write(sock, buf, len);
+ ret = write(sock, buf, len);
}