ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/hopm/branches/1.1.x/src/libopm/src/config.c
(Generate patch)

Comparing hopm/trunk/src/libopm/src/config.c (file contents):
Revision 5163 by michael, Thu Dec 25 18:51:51 2014 UTC vs.
Revision 5164 by michael, Fri Dec 26 18:52:10 2014 UTC

# Line 195 | Line 195 | OPM_ERR_T libopm_config_set(OPM_CONFIG_T
195           break;
196  
197        case OPM_TYPE_ADDRESS:
198 <         if( inet_pton(AF_INET, value, &( ((opm_sockaddr *)config->vars[key])->sa4.sin_addr))
199 <                  <= 0)
200 <            return OPM_ERR_BADVALUE; /* return appropriate err code */
201 <         break;
198 >      {
199 >        struct addrinfo hints, *res;
200 >
201 >        memset(&hints, 0, sizeof(hints));
202 >        hints.ai_family   = AF_INET;
203 >        hints.ai_socktype = SOCK_STREAM;
204 >        hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
205 >
206 >        if (getaddrinfo(value, NULL, &hints, &res))
207 >          return OPM_ERR_BADVALUE;  /* return appropriate err code */
208 >
209 >        memcpy(&(((opm_sockaddr *)config->vars[key])->sa4.sin_addr), &((struct sockaddr_in *)res->ai_addr)->sin_addr, sizeof(struct in_addr));
210 >        freeaddrinfo(res);
211 >        break;
212 >      }
213  
214        case OPM_TYPE_STRINGLIST:
215           node = libopm_node_create(libopm_xstrdup(value));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines