diff options
Diffstat (limited to 'gacopyz/server.c')
-rw-r--r-- | gacopyz/server.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gacopyz/server.c b/gacopyz/server.c index 401854b2..a4a05e49 100644 --- a/gacopyz/server.c +++ b/gacopyz/server.c @@ -645,14 +645,14 @@ gacopyz_srv_destroy(gacopyz_srv_t *p) static int srv_connect(gacopyz_srv_t srv, char *proto, char *port, char *path) { union { struct sockaddr sa; - struct sockaddr_in sin; - struct sockaddr_un sun; + struct sockaddr_in s_in; + struct sockaddr_un s_un; } addr; int socklen; int fd = -1; if (!proto || strcmp(proto, "unix") == 0 || strcmp(proto, "local") == 0) { @@ -663,23 +663,23 @@ srv_connect(gacopyz_srv_t srv, char *proto, char *port, char *path) _("Invalid connection type: %s; " "port is meaningless for UNIX sockets"), srv->portspec); return -1; } - if (strlen(path) > sizeof addr.sun.sun_path) { + if (strlen(path) > sizeof addr.s_un.sun_path) { errno = EINVAL; gacopyz_io_log(&srv->iod, SMI_LOG_ERR, _("%s: UNIX socket name too long"), path); return -1; } addr.sa.sa_family = PF_UNIX; - socklen = sizeof(addr.sun); - strcpy(addr.sun.sun_path, path); + socklen = sizeof(addr.s_un); + strcpy(addr.s_un.sun_path, path); if (stat(path, &st)) { gacopyz_io_log(&srv->iod, SMI_LOG_ERR, _("%s: cannot stat socket: %s"), path, strerror(errno)); return -1; @@ -696,13 +696,13 @@ srv_connect(gacopyz_srv_t srv, char *proto, char *port, char *path) } else if (strcmp(proto, "inet") == 0) { short pnum; long num; char *p; addr.sa.sa_family = PF_INET; - socklen = sizeof(addr.sin); + socklen = sizeof(addr.s_in); if (!port) { gacopyz_io_log(&srv->iod, SMI_LOG_ERR, _("Invalid connection type: %s; " "missing port number"), srv->portspec); @@ -729,26 +729,26 @@ srv_connect(gacopyz_srv_t srv, char *proto, char *port, char *path) return -1; } pnum = sp->s_port; } if (!path) - addr.sin.sin_addr.s_addr = INADDR_ANY; + addr.s_in.sin_addr.s_addr = INADDR_ANY; else { struct hostent *hp = gethostbyname(path); if (!hp) { gacopyz_io_log(&srv->iod, SMI_LOG_ERR, _("Unknown host name %s"), path); return -1; } addr.sa.sa_family = hp->h_addrtype; switch (hp->h_addrtype) { case AF_INET: - memmove(&addr.sin.sin_addr, hp->h_addr, 4); - addr.sin.sin_port = pnum; + memmove(&addr.s_in.sin_addr, hp->h_addr, 4); + addr.s_in.sin_port = pnum; break; default: gacopyz_io_log(&srv->iod, SMI_LOG_ERR, _("Invalid connection type: %s; " "unsupported address family"), |