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