1
0
mirror of https://github.com/moparisthebest/pacman synced 2025-03-02 10:21:49 -05:00

util.c : fix segfault when the cachedir isn't usable.

For example, if the cachedir is a broken symlink or a non writable
directory, pacman fallbacks to /tmp/. Just before doing that, it freed the
handle->cachedirs list twice !
once in _alpm_filecache_setup, and once in alpm_option_set_cachedirs. So the
first one was removed.

Fixes FS#9186.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
This commit is contained in:
Chantry Xavier 2008-01-13 01:55:08 +01:00 committed by Dan McGee
parent 3de2147376
commit ab506f77c0

View File

@ -582,9 +582,7 @@ const char *_alpm_filecache_setup(void)
}
/* we didn't find a valid cache directory. use /tmp. */
i = alpm_option_get_cachedirs();
tmp = alpm_list_add(NULL, strdup("/tmp/"));
FREELIST(i);
alpm_option_set_cachedirs(tmp);
_alpm_log(PM_LOG_DEBUG, "using cachedir: %s", "/tmp/\n");
_alpm_log(PM_LOG_WARNING, _("couldn't create package cache, using /tmp instead\n"));