Skip to content

Commit

Permalink
Curl_unix2addr: avoid using the variable name 'sun'
Browse files Browse the repository at this point in the history
I suspect this causes compile failures on Solaris:

Bug: http://curl.haxx.se/mail/lib-2014-12/0081.html
  • Loading branch information
bagder committed Dec 10, 2014
1 parent 0da4524 commit 1cc5194
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/curl_addrinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 1cc5194

Please sign in to comment.