Check that destfile_name exists before using it
In some cases (when trust_remote_name is used for a URL without a filename and no Content-Disposition is provided by the server) destfile_name will be NULL. In this case payload data will be stored in tempfile_name and no destfile_name is set. Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
1fd95939db
commit
14c0e53eed
1 changed files with 6 additions and 3 deletions
|
@ -897,15 +897,18 @@ int SYMEXPORT alpm_fetch_pkgurl(alpm_handle_t *handle, const alpm_list_t *urls,
|
||||||
|
|
||||||
for(i = payloads; i; i = i->next) {
|
for(i = payloads; i; i = i->next) {
|
||||||
struct dload_payload *payload = i->data;
|
struct dload_payload *payload = i->data;
|
||||||
const char *filename;
|
|
||||||
char *filepath;
|
char *filepath;
|
||||||
|
|
||||||
if(payload->signature) {
|
if(payload->signature) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
filename = mbasename(payload->destfile_name);
|
if(payload->destfile_name) {
|
||||||
filepath = _alpm_filecache_find(handle, filename);
|
const char *filename = mbasename(payload->destfile_name);
|
||||||
|
filepath = _alpm_filecache_find(handle, filename);
|
||||||
|
} else {
|
||||||
|
STRDUP(filepath, payload->tempfile_name, GOTO_ERR(handle, ALPM_ERR_MEMORY, err));
|
||||||
|
}
|
||||||
if(filepath) {
|
if(filepath) {
|
||||||
alpm_list_append(fetched, filepath);
|
alpm_list_append(fetched, filepath);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue