version 1.1.1.1.2.2, 2008/09/30 20:00:26
|
version 1.1.1.1.2.4, 2009/05/25 07:43:51
|
Line 89 int ReadConfig(FILE *f, sl_config * __restrict cfg)
|
Line 89 int ReadConfig(FILE *f, sl_config * __restrict cfg)
|
LOGERR; |
LOGERR; |
return -1; |
return -1; |
} else { |
} else { |
|
memset(av, 0, sizeof(struct tagPair)); |
// added new element |
// added new element |
av->sle_next = cfg->slh_first; |
av->sle_next = cfg->slh_first; |
cfg->slh_first = av; |
cfg->slh_first = av; |
Line 101 int ReadConfig(FILE *f, sl_config * __restrict cfg)
|
Line 102 int ReadConfig(FILE *f, sl_config * __restrict cfg)
|
free(av); |
free(av); |
return -1; |
return -1; |
} else |
} else |
strcpy((char*) av->psSection, (char*) szSection); | strlcpy((char*) av->psSection, (char*) szSection, strlen((char*) szSection) + 1); |
} else |
} else |
av->psSection = NULL; |
av->psSection = NULL; |
|
|
Line 122 int ReadConfig(FILE *f, sl_config * __restrict cfg)
|
Line 123 int ReadConfig(FILE *f, sl_config * __restrict cfg)
|
free(av); |
free(av); |
return -1; |
return -1; |
} else |
} else |
strcpy((char*) av->psAttribute, (char*) psAttr); | strlcpy((char*) av->psAttribute, (char*) psAttr, strlen((char*) psAttr) + 1); |
// added value to element |
// added value to element |
av->psValue = malloc(strlen((char*) psVal) + 1); |
av->psValue = malloc(strlen((char*) psVal) + 1); |
if (!av->psValue) { |
if (!av->psValue) { |
Line 132 int ReadConfig(FILE *f, sl_config * __restrict cfg)
|
Line 133 int ReadConfig(FILE *f, sl_config * __restrict cfg)
|
free(av); |
free(av); |
return -1; |
return -1; |
} else |
} else |
strcpy((char*) av->psValue, (char*) psVal); | strlcpy((char*) av->psValue, (char*) psVal, strlen((char*) psVal) + 1); |
} |
} |
} |
} |
|
|
Line 164 int WriteConfig(FILE *f, sl_config * __restrict cfg)
|
Line 165 int WriteConfig(FILE *f, sl_config * __restrict cfg)
|
|
|
for (av = cfg->slh_first; av; av = av->sle_next) { |
for (av = cfg->slh_first; av; av = av->sle_next) { |
if (av->psSection && strcmp((char*) av->psSection, (char*) szSection)) { |
if (av->psSection && strcmp((char*) av->psSection, (char*) szSection)) { |
bzero(szSection, MAX_STR + 1); | strlcpy((char*) szSection, (char*) av->psSection, MAX_STR + 1); |
strcpy((char*) szSection, (char*) av->psSection); | |
if (!cfgDbg(f, "\n[%s]\n", av->psSection)) { |
if (!cfgDbg(f, "\n[%s]\n", av->psSection)) { |
LOGERR; |
LOGERR; |
return -1; |
return -1; |