aboutsummaryrefslogtreecommitdiff
path: root/gconf/gconf-gram.y
diff options
context:
space:
mode:
Diffstat (limited to 'gconf/gconf-gram.y')
-rw-r--r--gconf/gconf-gram.y20
1 files changed, 13 insertions, 7 deletions
diff --git a/gconf/gconf-gram.y b/gconf/gconf-gram.y
index a1d9f2a..f7ee710 100644
--- a/gconf/gconf-gram.y
+++ b/gconf/gconf-gram.y
@@ -503,25 +503,29 @@ string_to_host (struct in_addr *in, const char *string)
memcpy (in, hp->h_addr, sizeof (struct in_addr));
}
return 0;
}
static int
-string_to_sockaddr (sockaddr_union_t *s, const char *string)
+string_to_sockaddr (struct gconf_sockaddr *sp, const char *string)
{
if (string[0] == '/')
{
- if (strlen (string) >= sizeof (s->s_un.sun_path))
+ struct sockaddr_un s_un;
+ if (strlen (string) >= sizeof (s_un.sun_path))
{
gconf_error (&gconf_current_locus, 0,
_("%s: UNIX socket name too long"),
string);
return 1;
}
- s->s_un.sun_family = AF_UNIX;
- strcpy (s->s_un.sun_path, string);
+ s_un.sun_family = AF_UNIX;
+ strcpy (s_un.sun_path, string);
+ sp->len = sizeof (s_un);
+ sp->sa = xmalloc (sp->len);
+ memcpy (sp->sa, &s_un, sp->len);
}
else
{
char *p = strchr (string, ':');
size_t len;
struct sockaddr_in sa;
@@ -580,13 +584,15 @@ string_to_sockaddr (sockaddr_union_t *s, const char *string)
sa.sin_port = gconf_default_port;
else
{
gconf_error (&gconf_current_locus, 0, _("missing port number"));
return 1;
}
- s->s_in = sa;
+ sp->len = sizeof (sa);
+ sp->sa = xmalloc (sp->len);
+ memcpy (sp->sa, &sa, sp->len);
}
return 0;
}
static int
string_convert (void *target, enum gconf_data_type type, const char *string)
@@ -686,13 +692,13 @@ string_convert (void *target, enum gconf_data_type type, const char *string)
_("%s: not a valid IP address or hostname"), string);
return 1;
}
break;
case gconf_type_sockaddr:
- return string_to_sockaddr ((sockaddr_union_t*)target, string);
+ return string_to_sockaddr ((struct gconf_sockaddr *)target, string);
/* FIXME: */
case gconf_type_cidr:
case gconf_type_section:
gconf_error (&gconf_current_locus, 0, _("INTERNAL ERROR at %s:%d"), __FILE__,
@@ -717,13 +723,13 @@ size_t gconf_type_size_tab[] = {
sizeof (intmax_t) /* gconf_type_intmax */,
sizeof (time_t) /* gconf_type_time */,
sizeof (int) /* gconf_type_bool */,
sizeof (struct in_addr) /* gconf_type_ipv4 */,
0 /* FIXME: gconf_type_cidr */,
sizeof (struct in_addr) /* gconf_type_host */,
- sizeof (sockaddr_union_t) /* gconf_type_sockaddr */,
+ sizeof (struct gconf_sockaddr) /* gconf_type_sockaddr */,
0 /* gconf_type_section */
};
#define gconf_type_size_count \
(sizeof (gconf_type_size_tab) / sizeof (gconf_type_size_tab[0]))
static void

Return to:

Send suggestions and report system problems to the System administrator.