summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2015-01-22 18:44:48 +0100
committerAndrew Gregory <andrew.gregory.8@gmail.com>2017-05-11 06:45:30 +0200
commit5a0782d4d11ed0d13852a3b311781388d63250fc (patch)
tree56211b4efdd63a5c44962d00915652edacd4fb1f
parent185082daa60cb34d6084e0dbf234de97d3b15788 (diff)
downloadpacman-5a0782d4d11ed0d13852a3b311781388d63250fc.tar.gz
pacman-5a0782d4d11ed0d13852a3b311781388d63250fc.tar.xz
pacman: properly set threads option
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
-rw-r--r--src/pacman/conf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 59c38696..93473465 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -105,6 +105,7 @@ config_t *config_new(void)
newconfig->logmask = ALPM_LOG_ERROR | ALPM_LOG_WARNING;
newconfig->configfile = strdup(CONFFILE);
newconfig->deltaratio = 0.0;
+ newconfig->threads = 1;
if(alpm_capabilities() & ALPM_CAPABILITY_SIGNATURES) {
newconfig->siglevel = ALPM_SIG_PACKAGE | ALPM_SIG_PACKAGE_OPTIONAL |
ALPM_SIG_DATABASE | ALPM_SIG_DATABASE_OPTIONAL;
@@ -618,14 +619,14 @@ static int _parse_options(const char *key, char *value,
}
threads = strtoul(value, &endptr, 10);
- if(*endptr != '\0' || threads < 0) {
+ if(*endptr != '\0' || threads < 1 || threads > UINT_MAX) {
pm_printf(ALPM_LOG_ERROR,
_("config file %s, line %d: invalid value for '%s' : '%s'\n"),
file, linenum, "Threads", value);
return 1;
}
config->threads = threads;
- pm_printf(ALPM_LOG_DEBUG, "config: Threads = %f\n", threads);
+ pm_printf(ALPM_LOG_DEBUG, "config: Threads = %lu\n", threads);
} else {
pm_printf(ALPM_LOG_WARNING,
_("config file %s, line %d: directive '%s' in section '%s' not recognized.\n"),
@@ -834,6 +835,7 @@ static int setup_libalpm(void)
alpm_option_set_checkspace(handle, config->checkspace);
alpm_option_set_usesyslog(handle, config->usesyslog);
alpm_option_set_deltaratio(handle, config->deltaratio);
+ alpm_option_set_thread_count(handle, config->threads);
alpm_option_set_ignorepkgs(handle, config->ignorepkg);
alpm_option_set_ignoregroups(handle, config->ignoregrp);