aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryaworsky <yaworsky>2005-09-16 09:26:26 +0000
committeryaworsky <yaworsky>2005-09-16 09:26:26 +0000
commitf5b4965699765375078f4feee8cd3a5c03d5b6ca (patch)
tree94b189e57250ade074fafa303276276bccf5f85e
parentbac9d79a04320f9a0fbe1a7b5d2d8e64ece6fb6c (diff)
downloadsyslog-win32-f5b4965699765375078f4feee8cd3a5c03d5b6ca.tar.gz
syslog-win32-f5b4965699765375078f4feee8cd3a5c03d5b6ca.tar.xz
syslog-win32-f5b4965699765375078f4feee8cd3a5c03d5b6ca.zip
Fixed locale issues.
-rw-r--r--daemon/conf.c18
-rw-r--r--daemon/pathnames.c8
2 files changed, 14 insertions, 12 deletions
diff --git a/daemon/conf.c b/daemon/conf.c
index 654e46b..19a5ad2 100644
--- a/daemon/conf.c
+++ b/daemon/conf.c
@@ -98,7 +98,7 @@ static void xml_start_element (GMarkupParseContext *context,
{
aval = *attribute_values;
if( strcmp( aname, "name" ) == 0 )
- source->name = g_strdup( aval );
+ source->name = g_locale_from_utf8( aval, -1, NULL, NULL, NULL );
else if( strcmp( aname, "type" ) == 0 )
{
if( strcmp( aval, "internal" ) == 0 )
@@ -140,7 +140,7 @@ static void xml_start_element (GMarkupParseContext *context,
{
aval = *attribute_values;
if( strcmp( aname, "name" ) == 0 )
- dest->name = g_strdup( aval );
+ dest->name = g_locale_from_utf8( aval, -1, NULL, NULL, NULL );
else if( strcmp( aname, "file" ) == 0 )
dest->file = normalize_pathname( aval );
else if( strcmp( aname, "rotate" ) == 0 )
@@ -184,9 +184,9 @@ static void xml_start_element (GMarkupParseContext *context,
else if( strcmp( aname, "olddir" ) == 0 )
dest->olddir = normalize_pathname( aval );
else if( strcmp( aname, "compresscmd" ) == 0 )
- dest->compresscmd = g_strdup( aval );
+ dest->compresscmd = g_locale_from_utf8( aval, -1, NULL, NULL, NULL );
else if( strcmp( aname, "compressoptions" ) == 0 )
- dest->compressoptions = g_strdup( aval );
+ dest->compressoptions = g_locale_from_utf8( aval, -1, NULL, NULL, NULL );
}
if( !dest->name )
ERR( "Undefined destination name at line %d\n", line_number );
@@ -217,7 +217,7 @@ static void xml_start_element (GMarkupParseContext *context,
for( ; (aname = *attribute_names) != NULL; attribute_names++, attribute_values++ )
{
if( strcmp( aname, "name" ) == 0 )
- current_filter->name = g_strdup( *attribute_values );
+ current_filter->name = g_locale_from_utf8( *attribute_values, -1, NULL, NULL, NULL );
}
if( !current_filter->name )
{
@@ -238,11 +238,11 @@ static void xml_start_element (GMarkupParseContext *context,
{
aval = *attribute_values;
if( strcmp( aname, "source" ) == 0 )
- logpath->source = g_strdup( aval );
+ logpath->source = g_locale_from_utf8( aval, -1, NULL, NULL, NULL );
else if( strcmp( aname, "filter" ) == 0 )
- logpath->filter = g_strdup( aval );
+ logpath->filter = g_locale_from_utf8( aval, -1, NULL, NULL, NULL );
else if( strcmp( aname, "destination" ) == 0 )
- logpath->destination = g_strdup( aval );
+ logpath->destination = g_locale_from_utf8( aval, -1, NULL, NULL, NULL );
}
if( !logpath->source )
ERR( "Undefined log path source at line %d\n", line_number );
@@ -279,7 +279,7 @@ static void xml_start_element (GMarkupParseContext *context,
else if( strcmp( aname, "mark_interval" ) == 0 )
mark_interval = strtoul( aval, NULL, 0 );
else if( strcmp( aname, "mark_message" ) == 0 )
- mark_message = g_strdup( aval );
+ mark_message = g_locale_from_utf8( aval, -1, NULL, NULL, NULL );
else if( strcmp( aname, "hold" ) == 0 )
{
hold = strtoul( aval, NULL, 0 );
diff --git a/daemon/pathnames.c b/daemon/pathnames.c
index 932c854..8d4b09a 100644
--- a/daemon/pathnames.c
+++ b/daemon/pathnames.c
@@ -81,14 +81,16 @@ void create_directories( gchar* pathname )
* normalize_pathname
*
* Remove . and .. from pathname.
- * Return NULL if pathname is invalid.
+ * Pathname should be in UTF-8 encoding.
+ * Return NULL if pathname is invalid or normalized pathname
+ * in locale encoding.
*/
gchar* normalize_pathname( const gchar* pathname )
{
- gchar *ret = g_strdup( pathname );
+ gchar *ret = g_locale_from_utf8( pathname, -1, NULL, NULL, NULL );
gchar *first_element, *current_element, *next_element;
- TRACE_ENTER( "%s\n", pathname );
+ TRACE_ENTER( "%s\n", ret );
first_element = (gchar*) g_path_skip_root( ret );
if( !first_element )