diff options
Diffstat (limited to 'libftpconn')
-rw-r--r-- | libftpconn/set-type.c | 21 |
1 files changed, 11 insertions, 10 deletions
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; + } } } |