From 338b151fcdaa070b58d579dd0db5152f3e2adff6 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Mon, 18 Aug 1997 17:42:27 +0000 Subject: (ftp_conn_set_type): If there's no connection, don't open a new one, just save the type for later. --- libftpconn/set-type.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'libftpconn') diff --git a/libftpconn/set-type.c b/libftpconn/set-type.c index dba44c36..6c500ce6 100644 --- a/libftpconn/set-type.c +++ b/libftpconn/set-type.c @@ -42,16 +42,17 @@ ftp_conn_set_type (struct ftp_conn *conn, const char *type) else { int reply; - error_t err = ftp_conn_cmd_reopen (conn, "type", type, &reply, 0); - if (! err) - if (reply == REPLY_OK) - { - if (conn->type) - free ((char *)conn->type); - conn->type = type; - } - else - err = unexpected_reply (conn, reply, 0, 0); + error_t err = ftp_conn_cmd (conn, "type", type, &reply, 0); + + if (!err && reply != REPLY_OK && reply != REPLY_CLOSED) + err = unexpected_reply (conn, reply, 0, 0); + + if (!err || err == EPIPE) + { + if (conn->type) + free ((char *)conn->type); + conn->type = type; + } } } -- cgit v1.2.3