diff options
author | Miles Bader <miles@gnu.org> | 1997-08-18 17:42:27 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1997-08-18 17:42:27 +0000 |
commit | 338b151fcdaa070b58d579dd0db5152f3e2adff6 (patch) | |
tree | c3be85147efddf0dea0997a7032a93f24ddfc9e7 | |
parent | 8d9f11de2a7696c1a634a42d3f10fc0221bc2e90 (diff) |
(ftp_conn_set_type):
If there's no connection, don't open a new one, just save the type for
later.
-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; + } } } |