fix: don't reuse section names as pool names
This commit is contained in:
parent
41318f3b1f
commit
dc6bdefe07
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-08-18 04:00+0300\n"
|
||||
"POT-Creation-Date: 2024-08-18 04:11+0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -37,7 +37,7 @@ msgstr "Kayıt dosyasını açmak başarısız oldu: %s"
|
||||
msgid "Failed to parse the configuration"
|
||||
msgstr "Kayıt dosyasını açmak başarısız oldu: %s"
|
||||
|
||||
#: src/config.c:157
|
||||
#: src/config.c:160
|
||||
#, fuzzy, c-format
|
||||
msgid "Hostname not specified for the pool: %s"
|
||||
msgstr "Ana makine adı havuz konfigürasyonunda belirtilmedi, geçiliyor: %s"
|
||||
|
22
src/config.c
22
src/config.c
@ -21,21 +21,21 @@ config_t config = {
|
||||
.pools = NULL,
|
||||
};
|
||||
|
||||
pool_config_t *config_pool_add(char *name) {
|
||||
pool_config_t *config_pool_add(char *section) {
|
||||
pool_config_t *pool = malloc(sizeof(pool_config_t));
|
||||
bzero(pool, sizeof(pool_config_t));
|
||||
|
||||
pool->name = strdup(name);
|
||||
pool->next = config.pools;
|
||||
config.pools = pool;
|
||||
pool->section = strdup(section);
|
||||
pool->next = config.pools;
|
||||
config.pools = pool;
|
||||
|
||||
return pool;
|
||||
}
|
||||
|
||||
bool config_pool_contains(char *name) {
|
||||
bool config_pool_contains(char *section) {
|
||||
pool_config_t *cur = config.pools;
|
||||
while (NULL != cur) {
|
||||
if (eq(cur->name, name))
|
||||
if (eq(cur->section, section))
|
||||
return true;
|
||||
cur = cur->next;
|
||||
}
|
||||
@ -153,10 +153,14 @@ bool config_load(char *file) {
|
||||
|
||||
pool_config_t *pool = config.pools;
|
||||
while (NULL != pool) {
|
||||
if (NULL == pool->name)
|
||||
pool->name = pool->section;
|
||||
|
||||
if (NULL == pool->host) {
|
||||
error(_("Hostname not specified for the pool: %s"), pool->name);
|
||||
return false;
|
||||
}
|
||||
|
||||
pool = pool->next;
|
||||
}
|
||||
|
||||
@ -172,8 +176,12 @@ void config_free() {
|
||||
old = cur;
|
||||
cur = cur->next;
|
||||
|
||||
free(old->section);
|
||||
if (old->section != old->name)
|
||||
free(old->name);
|
||||
free(old->host);
|
||||
free(old->name);
|
||||
free(old->path);
|
||||
free(old->dir);
|
||||
free(old);
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ typedef struct config_option {
|
||||
|
||||
typedef struct pool_config {
|
||||
struct pool_config *next;
|
||||
char *section;
|
||||
char *name;
|
||||
char *host;
|
||||
char *path;
|
||||
|
Loading…
Reference in New Issue
Block a user