~ubuntu-branches/ubuntu/precise/autofs5/precise

« back to all changes in this revision

Viewing changes to modules/replicated.c

  • Committer: Bazaar Package Importer
  • Author(s): Dave Walker (Daviey)
  • Date: 2011-07-14 12:38:56 UTC
  • Revision ID: james.westby@ubuntu.com-20110714123856-q74l9sm0zcfq1dkb
Tags: 5.0.6-0ubuntu2
* debian/patches/non-ipv6-hostname-lookups.patch: Resolve regression of not 
  being able to lookup non IPv6 hostnames, patch courtesy of upstream. 
  (LP: #810397)
* debian/control: 
  - Removed dpatch from build-dep as package is now using
    quilt to handle patches.
  - Bumped standards to 3.9.2, no changes required.
* debian/rules: Added targets build-arch & build-indep to satisfy lintian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1111
1111
                          unsigned int weight, unsigned int options)
1112
1112
{
1113
1113
        struct addrinfo hints, *ni, *this;
1114
 
        char *name = strdup(host);
 
1114
        char *n_ptr;
 
1115
        char *name = n_ptr = strdup(host);
1115
1116
        int len;
1116
1117
        char buf[MAX_ERR_BUF];
1117
1118
        int rr = 0;
1125
1126
        }
1126
1127
        len = strlen(name);
1127
1128
 
1128
 
        if (name[0] == '[' && name[--len] == ']')
 
1129
        if (name[0] == '[' && name[--len] == ']') {
1129
1130
                name[len] = '\0';
 
1131
                name++;
 
1132
        }
1130
1133
 
1131
1134
        memset(&hints, 0, sizeof(hints));
1132
1135
        hints.ai_flags = AI_NUMERICHOST;
1133
1136
        hints.ai_family = AF_UNSPEC;
1134
1137
        hints.ai_socktype = SOCK_DGRAM;
1135
1138
 
1136
 
        ret = getaddrinfo(name + 1, NULL, &hints, &ni);
 
1139
        ret = getaddrinfo(name, NULL, &hints, &ni);
1137
1140
        if (ret)
1138
1141
                goto try_name;
1139
1142
 
1153
1156
        hints.ai_family = AF_UNSPEC;
1154
1157
        hints.ai_socktype = SOCK_DGRAM;
1155
1158
 
1156
 
        ret = getaddrinfo(name + 1, NULL, &hints, &ni);
 
1159
        ret = getaddrinfo(name, NULL, &hints, &ni);
1157
1160
        if (ret) {
1158
1161
                error(LOGOPT_ANY, "hostname lookup failed: %s",
1159
1162
                      gai_strerror(ret));
1172
1175
        }
1173
1176
        freeaddrinfo(ni);
1174
1177
done:
1175
 
        free(name);
 
1178
        free(n_ptr);
1176
1179
        return ret;
1177
1180
}
1178
1181