summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/compat.c11
-rw-r--r--common/config-parser.c16
2 files changed, 10 insertions, 17 deletions
diff --git a/common/compat.c b/common/compat.c
index c6138d0..50a2be7 100644
--- a/common/compat.c
+++ b/common/compat.c
@@ -136,15 +136,8 @@ strtob(const char* str)
size_t
strlcpy(char *dst, const char *src, size_t len)
{
- size_t ret = strlen(dst);
-
- while (len > 1) {
- *dst++ = *src++;
- len--;
- }
- if (len > 0)
- *dst = '\0';
- return (ret);
+ *dst = 0;
+ return strlcat(dst, src, len);
}
#endif /* HAVE_STRLCPY */
diff --git a/common/config-parser.c b/common/config-parser.c
index 36c8ba9..c096104 100644
--- a/common/config-parser.c
+++ b/common/config-parser.c
@@ -66,10 +66,10 @@ static char*
read_config_file(const char** configfile, void* data)
{
char* config = NULL;
- char* newfilename;
+ char* newfilename;
FILE* f = NULL;
long len;
- int flen;
+ int flen;
ASSERT(configfile);
@@ -87,7 +87,7 @@ read_config_file(const char** configfile, void* data)
return NULL;
}
- flen = strlen(*configfile);
+ flen = strlen(*configfile);
if((config = (char*)malloc(len + 4 + flen)) == NULL)
{
errmsg(*configfile, data, "out of memory");
@@ -110,9 +110,9 @@ read_config_file(const char** configfile, void* data)
/* Remove nasty dos line endings */
strcln(config, '\r');
- /* Persistent allocation for filename */
- newfilename = config + len + 2;
- strcpy(newfilename, *configfile);
+ /* Persistent allocation for filename */
+ newfilename = config + len + 2;
+ strcpy(newfilename, *configfile);
*configfile = newfilename;
return config;
@@ -171,7 +171,7 @@ cfg_parse_file(const char* filename, void* data, char** memory)
/* No continuation hand off value if necessary */
if(name && value)
{
- if(cfg_value(filename, header, name, value, data) == -1)
+ if(cfg_value(filename, header, name, strtrim(value), data) == -1)
goto finally;
}
@@ -212,7 +212,7 @@ cfg_parse_file(const char* filename, void* data, char** memory)
t++;
name = strtrim(p);
- value = strtrim(t);
+ value = t;
}
if(name && value)