diff options
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/net/name6.c | 1 | ||||
-rw-r--r-- | lib/libc/resolv/res_query.c | 2 | ||||
-rw-r--r-- | lib/libc/tests/nss/testutil.h | 33 |
3 files changed, 16 insertions, 20 deletions
diff --git a/lib/libc/net/name6.c b/lib/libc/net/name6.c index 74d7380..ebae9d3 100644 --- a/lib/libc/net/name6.c +++ b/lib/libc/net/name6.c @@ -655,7 +655,6 @@ _hpreorder(struct hostent *hp) #endif break; default: - free_addrselectpolicy(&policyhead); return hp; } diff --git a/lib/libc/resolv/res_query.c b/lib/libc/resolv/res_query.c index 5992edd..a6df3f2 100644 --- a/lib/libc/resolv/res_query.c +++ b/lib/libc/resolv/res_query.c @@ -136,8 +136,8 @@ again: if (n > 0 && (statp->_flags & RES_F_EDNS0ERR) == 0 && (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC|RES_NSID))) { n = res_nopt(statp, n, buf, sizeof(buf), anslen); - rdata = &buf[n]; if (n > 0 && (statp->options & RES_NSID) != 0U) { + rdata = &buf[n]; n = res_nopt_rdata(statp, n, buf, sizeof(buf), rdata, NS_OPT_NSID, 0, NULL); } diff --git a/lib/libc/tests/nss/testutil.h b/lib/libc/tests/nss/testutil.h index 39c4f41..ff9e8f0 100644 --- a/lib/libc/tests/nss/testutil.h +++ b/lib/libc/tests/nss/testutil.h @@ -252,9 +252,7 @@ int \ __##ent##_snapshot_read(char const *fname, struct ent##_test_data *td, \ int (*read_func)(struct ent *, char *)) \ { \ - char buffer[1024]; \ struct ent data; \ - char *s; \ FILE *fi; \ size_t len; \ int rv; \ @@ -267,23 +265,22 @@ __##ent##_snapshot_read(char const *fname, struct ent##_test_data *td, \ return (-1); \ \ rv = 0; \ - memset(buffer, 0, sizeof(buffer)); \ while (!feof(fi)) { \ - s = fgets(buffer, sizeof(buffer), fi); \ - if (s != NULL && s[0] != '#') { \ - len = strlen(s); \ - if (len == 0) \ - continue; \ - if (buffer[len - 1] == '\n') \ - buffer[len -1] = '\0'; \ - \ - rv = read_func(&data, s); \ - if (rv == 0) { \ - __##ent##_test_data_append(td, &data); \ - td->free_func(&data); \ - } else \ - goto fin; \ - } \ + char *buf = fgetln(fi, &len); \ + if (buf == NULL || len <= 1) \ + continue; \ + if (buf[len - 1] == '\n') \ + buf[len - 1] = '\0'; \ + else \ + buf[len] = '\0'; \ + if (buf[0] == '#') \ + continue; \ + rv = read_func(&data, buf); \ + if (rv == 0) { \ + __##ent##_test_data_append(td, &data); \ + td->free_func(&data); \ + } else \ + goto fin; \ } \ \ fin: \ |