Curl_unix2addr: avoid using the variable name 'sun'

I suspect this causes compile failures on Solaris:

Bug: http://curl.haxx.se/mail/lib-2014-12/0081.html
This commit is contained in:
Daniel Stenberg 2014-12-10 13:12:26 +01:00
parent 0da4524a22
commit 1cc5194337

View File

@ -488,7 +488,7 @@ Curl_addrinfo *Curl_str2addr(char *address, int port)
Curl_addrinfo *Curl_unix2addr(const char *path)
{
Curl_addrinfo *ai;
struct sockaddr_un *sun;
struct sockaddr_un *sa_un;
size_t path_len;
ai = calloc(1, sizeof(Curl_addrinfo));
@ -500,7 +500,7 @@ Curl_addrinfo *Curl_unix2addr(const char *path)
}
/* sun_path must be able to store the NUL-terminated path */
path_len = strlen(path);
if(path_len >= sizeof(sun->sun_path)) {
if(path_len >= sizeof(sa_un->sun_path)) {
free(ai->ai_addr);
free(ai);
return NULL;
@ -509,9 +509,9 @@ Curl_addrinfo *Curl_unix2addr(const char *path)
ai->ai_family = AF_UNIX;
ai->ai_socktype = SOCK_STREAM; /* assume reliable transport for HTTP */
ai->ai_addrlen = (curl_socklen_t) sizeof(struct sockaddr_un);
sun = (void *) ai->ai_addr;
sun->sun_family = AF_UNIX;
memcpy(sun->sun_path, path, path_len + 1); /* copy NUL byte */
sa_un = (void *) ai->ai_addr;
sa_un->sun_family = AF_UNIX;
memcpy(sa_un->sun_path, path, path_len + 1); /* copy NUL byte */
return ai;
}
#endif