Skip to content

Instantly share code, notes, and snippets.

@rem7
Created February 7, 2012 22:57
Show Gist options
  • Save rem7/1762716 to your computer and use it in GitHub Desktop.
Save rem7/1762716 to your computer and use it in GitHub Desktop.

Revisions

  1. Yanko created this gist Feb 7, 2012.
    13 changes: 13 additions & 0 deletions gistfile1.c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@

    @@ -230,7 +230,12 @@ int redisContextConnectTcp(redisContext *c, const char *addr, int port, struct t

    sa.sin_family = AF_INET;
    sa.sin_port = htons(port);
    - if (inet_pton(AF_INET, addr, &sa.sin_addr) == 0) {
    +
    + // Windows XP does not support inet_pton so using
    + // inet_addr instead.
    + sa.sin_addr.S_un.S_addr = inet_addr(addr);
    + if( sa.sin_addr.S_un.S_addr == INADDR_ANY || sa.sin_addr.S_un.S_addr == INADDR_NONE) {
    + // if (inet_pton(AF_INET, addr, &sa.sin_addr) == 0) {
    struct hostent *he;