diff options
Diffstat (limited to 'ext/ftp/ftp.c')
-rw-r--r-- | ext/ftp/ftp.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index 916e706c72..1a5e807e8b 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -167,7 +167,7 @@ ftp_close(ftpbuf_t *ftp) { if (ftp == NULL) return NULL; - if (ftp->fd) + if (ftp->fd != -1) close(ftp->fd); ftp_gc(ftp); free(ftp); @@ -682,6 +682,21 @@ ftp_rename(ftpbuf_t *ftp, const char *src, const char *dest) return 1; } + +int +ftp_site(ftpbuf_t *ftp, const char *cmd) +{ + if (ftp == NULL) + return 0; + + if (!ftp_putcmd(ftp, "SITE", cmd)) + return 0; + if (!ftp_getresp(ftp) || ftp->resp < 200 || ftp->resp >= 300) + return 0; + + return 1; +} + /* static functions */ int |