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.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index c1f54f02..6aaff1d2 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
@@ -324,7 +322,7 @@ static void curl_set_handle_opts(struct dload_payload *payload,
}
}
-static void mask_signal(int signal, void (*handler)(int),
+static void mask_signal(int signum, void (*handler)(int),
struct sigaction *origaction)
{
struct sigaction newaction;
@@ -333,13 +331,13 @@ static void mask_signal(int signal, void (*handler)(int),
sigemptyset(&newaction.sa_mask);
newaction.sa_flags = 0;
- sigaction(signal, NULL, origaction);
- sigaction(signal, &newaction, NULL);
+ sigaction(signum, NULL, origaction);
+ sigaction(signum, &newaction, NULL);
}
-static void unmask_signal(int signal, struct sigaction *sa)
+static void unmask_signal(int signum, struct sigaction *sa)
{
- sigaction(signal, sa, NULL);
+ sigaction(signum, sa, NULL);
}
static FILE *create_tempfile(struct dload_payload *payload, const char *localpath)
@@ -357,9 +355,7 @@ static FILE *create_tempfile(struct dload_payload *payload, const char *localpat
fchmod(fd, ~(_getumask()) & 0666) ||
!(fp = fdopen(fd, payload->tempfile_openmode))) {
unlink(randpath);
- if(fd >= 0) {
- close(fd);
- }
+ CLOSE(fd);
_alpm_log(payload->handle, ALPM_LOG_ERROR,
_("failed to create temporary file for download\n"));
return NULL;
@@ -432,6 +428,10 @@ static int curl_download_internal(struct dload_payload *payload,
if(localf == NULL) {
localf = fopen(payload->tempfile_name, payload->tempfile_openmode);
if(localf == NULL) {
+ handle->pm_errno = ALPM_ERR_RETRIEVE;
+ _alpm_log(handle, ALPM_LOG_ERROR,
+ _("could not open file %s: %s\n"),
+ payload->tempfile_name, strerror(errno));
goto cleanup;
}
}
@@ -623,18 +623,18 @@ int _alpm_download(struct dload_payload *payload, const char *localpath,
static char *filecache_find_url(alpm_handle_t *handle, const char *url)
{
- const char *basename = strrchr(url, '/');
+ const char *filebase = strrchr(url, '/');
- if(basename == NULL) {
+ if(filebase == NULL) {
return NULL;
}
- basename++;
- if(basename == '\0') {
+ filebase++;
+ if(filebase == '\0') {
return NULL;
}
- return _alpm_filecache_find(handle, basename);
+ return _alpm_filecache_find(handle, filebase);
}
/** Fetch a remote pkg. */