summaryrefslogtreecommitdiffstats
path: root/lib/libfetch
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2000-07-11 23:50:22 +0000
committerdes <des@FreeBSD.org>2000-07-11 23:50:22 +0000
commitd908f153d0c1a01bdb580b8029f8c40dc1263ff6 (patch)
treec9046e2b1469400248ee169dfc0d79c2afc7598c /lib/libfetch
parent848e1688b8b197884a50800324df1f3d1399c2b4 (diff)
downloadFreeBSD-src-d908f153d0c1a01bdb580b8029f8c40dc1263ff6.zip
FreeBSD-src-d908f153d0c1a01bdb580b8029f8c40dc1263ff6.tar.gz
Use fetch_putln()
Diffstat (limited to 'lib/libfetch')
-rw-r--r--lib/libfetch/ftp.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c
index cb12eaa..60ffe96 100644
--- a/lib/libfetch/ftp.c
+++ b/lib/libfetch/ftp.c
@@ -57,7 +57,6 @@
#include <sys/param.h>
#include <sys/socket.h>
-#include <sys/uio.h>
#include <netinet/in.h>
#include <ctype.h>
@@ -92,8 +91,6 @@
#define FTP_FILE_OK 350
#define FTP_SYNTAX_ERROR 500
-static char ENDL[2] = "\r\n";
-
static struct url cached_host;
static int cached_socket;
@@ -170,12 +167,12 @@ static int
_ftp_cmd(int cd, char *fmt, ...)
{
va_list ap;
- struct iovec iov[2];
+ size_t len;
char *msg;
int r;
va_start(ap, fmt);
- vasprintf(&msg, fmt, ap);
+ len = vasprintf(&msg, fmt, ap);
va_end(ap);
if (msg == NULL) {
@@ -183,13 +180,10 @@ _ftp_cmd(int cd, char *fmt, ...)
_fetch_syserr();
return -1;
}
- DEBUG(fprintf(stderr, "\033[1m>>> %s\n\033[m", msg));
- iov[0].iov_base = msg;
- iov[0].iov_len = strlen(msg);
- iov[1].iov_base = ENDL;
- iov[1].iov_len = sizeof ENDL;
- r = writev(cd, iov, 2);
+
+ r = _fetch_putln(cd, msg, len);
free(msg);
+
if (r == -1) {
_fetch_syserr();
return -1;
OpenPOWER on IntegriCloud