summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/dload.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/dload.c')
-rw-r--r--lib/libalpm/dload.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index c11148d1..cb6d000c 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -1,7 +1,7 @@
/*
* download.c
*
- * Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
+ * Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -29,16 +29,13 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
-#include <limits.h>
-/* the following two are needed on BSD for libfetch */
-#if defined(HAVE_SYS_SYSLIMITS_H)
-#include <sys/syslimits.h> /* PATH_MAX */
-#endif
+/* the following two are needed for FreeBSD's libfetch */
+#include <limits.h> /* PATH_MAX */
#if defined(HAVE_SYS_PARAM_H)
#include <sys/param.h> /* MAXHOSTNAMELEN */
#endif
-#if defined(INTERNAL_DOWNLOAD)
+#ifdef HAVE_LIBFETCH
#include <fetch.h>
#endif
@@ -58,7 +55,7 @@ static char *get_filename(const char *url) {
return(filename);
}
-#if defined(INTERNAL_DOWNLOAD)
+#ifdef HAVE_LIBFETCH
static char *get_destfile(const char *path, const char *filename) {
char *destfile;
/* len = localpath len + filename len + null */
@@ -89,7 +86,7 @@ static const char *gethost(struct url *fileurl)
}
int dload_interrupted;
-static RETSIGTYPE inthandler(int signum)
+static void inthandler(int signum)
{
dload_interrupted = 1;
}
@@ -250,8 +247,8 @@ static int download_internal(const char *url, const char *localpath,
while((nread = fetchIO_read(dlf, buffer, PM_DLBUF_LEN)) > 0) {
check_stop();
size_t nwritten = 0;
- nwritten = fwrite(buffer, 1, nread, localf);
- if((nwritten != nread) || ferror(localf)) {
+ nwritten = fwrite(buffer, 1, (size_t)nread, localf);
+ if((nwritten != (size_t)nread) || ferror(localf)) {
pm_errno = PM_ERR_RETRIEVE;
_alpm_log(PM_LOG_ERROR, _("error writing to file '%s': %s\n"),
tempfile, strerror(errno));
@@ -338,7 +335,7 @@ cleanup:
static int download(const char *url, const char *localpath,
int force) {
if(handle->fetchcb == NULL) {
-#if defined(INTERNAL_DOWNLOAD)
+#ifdef HAVE_LIBFETCH
return(download_internal(url, localpath, force));
#else
RET_ERR(PM_ERR_EXTERNAL_DOWNLOAD, -1);