From owner-svn-src-stable-10@freebsd.org Fri Dec 4 09:18:14 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44706A3FCA8; Fri, 4 Dec 2015 09:18:14 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D398179A; Fri, 4 Dec 2015 09:18:13 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB49IDtg051587; Fri, 4 Dec 2015 09:18:13 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB49IC8O051583; Fri, 4 Dec 2015 09:18:12 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512040918.tB49IC8O051583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 4 Dec 2015 09:18:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r291759 - stable/10/tools/regression/lib/libc/nss X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2015 09:18:14 -0000 Author: ngie Date: Fri Dec 4 09:18:12 2015 New Revision: 291759 URL: https://svnweb.freebsd.org/changeset/base/291759 Log: MFC r291363: Clean up trailing whitespace Modified: stable/10/tools/regression/lib/libc/nss/test-getaddr.c stable/10/tools/regression/lib/libc/nss/test-getgr.c stable/10/tools/regression/lib/libc/nss/test-gethostby.c stable/10/tools/regression/lib/libc/nss/test-getproto.c stable/10/tools/regression/lib/libc/nss/test-getpw.c stable/10/tools/regression/lib/libc/nss/test-getrpc.c stable/10/tools/regression/lib/libc/nss/test-getserv.c stable/10/tools/regression/lib/libc/nss/test-getusershell.c stable/10/tools/regression/lib/libc/nss/testutil.h Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/regression/lib/libc/nss/test-getaddr.c ============================================================================== --- stable/10/tools/regression/lib/libc/nss/test-getaddr.c Fri Dec 4 09:10:49 2015 (r291758) +++ stable/10/tools/regression/lib/libc/nss/test-getaddr.c Fri Dec 4 09:18:12 2015 (r291759) @@ -67,22 +67,22 @@ IMPLEMENT_TEST_DATA(addrinfo) IMPLEMENT_TEST_FILE_SNAPSHOT(addrinfo) IMPLEMENT_2PASS_TEST(addrinfo) -static void +static void clone_addrinfo(struct addrinfo *dest, struct addrinfo const *src) { assert(dest != NULL); assert(src != NULL); - + memcpy(dest, src, sizeof(struct addrinfo)); if (src->ai_canonname != NULL) dest->ai_canonname = strdup(src->ai_canonname); - + if (src->ai_addr != NULL) { dest->ai_addr = (struct sockaddr *)malloc(src->ai_addrlen); assert(dest->ai_addr != NULL); memcpy(dest->ai_addr, src->ai_addr, src->ai_addrlen); } - + if (src->ai_next != NULL) { dest->ai_next = (struct addrinfo *)malloc( sizeof(struct addrinfo)); @@ -96,7 +96,7 @@ compare_addrinfo_(struct addrinfo *ai1, { if ((ai1 == NULL) || (ai2 == NULL)) return (-1); - + if ((ai1->ai_flags != ai2->ai_flags) || (ai1->ai_family != ai2->ai_family) || (ai1->ai_socktype != ai2->ai_socktype) || @@ -107,11 +107,11 @@ compare_addrinfo_(struct addrinfo *ai1, (((ai1->ai_canonname == NULL) || (ai2->ai_canonname == NULL)) && (ai1->ai_canonname != ai2->ai_canonname))) return (-1); - - if ((ai1->ai_canonname != NULL) && + + if ((ai1->ai_canonname != NULL) && (strcmp(ai1->ai_canonname, ai2->ai_canonname) != 0)) return (-1); - + if ((ai1->ai_addr != NULL) && (memcmp(ai1->ai_addr, ai2->ai_addr, ai1->ai_addrlen) != 0)) return (-1); @@ -122,17 +122,17 @@ compare_addrinfo_(struct addrinfo *ai1, return (compare_addrinfo_(ai1->ai_next, ai2->ai_next)); } -static int +static int compare_addrinfo(struct addrinfo *ai1, struct addrinfo *ai2, void *mdata) { int rv; - + if (debug) { printf("testing equality of 2 addrinfo structures\n"); } rv = compare_addrinfo_(ai1, ai2); - + if (debug) { if (rv == 0) printf("equal\n"); @@ -142,16 +142,16 @@ compare_addrinfo(struct addrinfo *ai1, s printf("not equal\n"); } } - + return (rv); } -void +void free_addrinfo(struct addrinfo *ai) { if (ai == NULL) return; - + free(ai->ai_addr); free(ai->ai_canonname); free_addrinfo(ai->ai_next); @@ -159,9 +159,9 @@ free_addrinfo(struct addrinfo *ai) void sdump_addrinfo(struct addrinfo *ai, char *buffer, size_t buflen) -{ +{ int written, i; - + written = snprintf(buffer, buflen, "%d %d %d %d %d ", ai->ai_flags, ai->ai_family, ai->ai_socktype, ai->ai_protocol, ai->ai_addrlen); @@ -169,14 +169,14 @@ sdump_addrinfo(struct addrinfo *ai, char if (written > buflen) return; buflen -= written; - + written = snprintf(buffer, buflen, "%s ", ai->ai_canonname == NULL ? "(null)" : ai->ai_canonname); buffer += written; if (written > buflen) return; buflen -= written; - + if (ai->ai_addr == NULL) { written = snprintf(buffer, buflen, "(null)"); buffer += written; @@ -185,26 +185,26 @@ sdump_addrinfo(struct addrinfo *ai, char buflen -= written; } else { for (i = 0; i < ai->ai_addrlen; ++i ) { - written = snprintf(buffer, buflen, + written = snprintf(buffer, buflen, i + 1 != ai->ai_addrlen ? "%d." : "%d", ((unsigned char *)ai->ai_addr)[i]); buffer += written; if (written > buflen) return; buflen -= written; - + if (buflen == 0) return; - } + } } - + if (ai->ai_next != NULL) { written = snprintf(buffer, buflen, ":"); buffer += written; if (written > buflen) return; buflen -= written; - + sdump_addrinfo(ai->ai_next, buffer, buflen); } } @@ -224,12 +224,12 @@ static int addrinfo_read_snapshot_addr(char *addr, unsigned char *result, size_t len) { char *s, *ps, *ts; - + ps = addr; while ( (s = strsep(&ps, ".")) != NULL) { if (len == 0) return (-1); - + *result = (unsigned char)strtol(s, &ts, 10); ++result; if (*ts != '\0') @@ -265,7 +265,7 @@ addrinfo_read_snapshot_ai(struct addrinf goto fin; break; case 4: - ai->ai_addrlen = (socklen_t)strtol(s, &ts, 10); + ai->ai_addrlen = (socklen_t)strtol(s, &ts, 10); if (*ts != '\0') goto fin; break; @@ -274,7 +274,7 @@ addrinfo_read_snapshot_ai(struct addrinf ai->ai_canonname = strdup(s); assert(ai->ai_canonname != NULL); } - break; + break; case 6: if (strcmp(s, "(null)") != 0) { ai->ai_addr = (struct sockaddr *)malloc( @@ -284,7 +284,7 @@ addrinfo_read_snapshot_ai(struct addrinf rv = addrinfo_read_snapshot_addr(s, (unsigned char *)ai->ai_addr, ai->ai_addrlen); - + if (rv != 0) goto fin; } @@ -294,18 +294,18 @@ addrinfo_read_snapshot_ai(struct addrinf rv = -1; goto fin; }; - + ++i; } fin: - if ((i != 7) || (rv != 0)) { + if ((i != 7) || (rv != 0)) { free_addrinfo(ai); memset(ai, 0, sizeof(struct addrinfo)); return (-1); } - - return (0); + + return (0); } static int @@ -317,33 +317,33 @@ addrinfo_read_snapshot_func(struct addri if (debug) printf("1 line read from snapshot:\n%s\n", line); - + rv = 0; i = 0; ps = line; - + s = strsep(&ps, ":"); if (s == NULL) return (-1); - + rv = addrinfo_read_snapshot_ai(ai, s); if (rv != 0) return (-1); - + ai2 = ai; while ( (s = strsep(&ps, ":")) != NULL) { ai2->ai_next = (struct addrinfo *)malloc( sizeof(struct addrinfo)); assert(ai2->ai_next != NULL); memset(ai2->ai_next, 0, sizeof(struct addrinfo)); - + rv = addrinfo_read_snapshot_ai(ai2->ai_next, s); if (rv != 0) { - free_addrinfo(ai); + free_addrinfo(ai); return (-1); } - ai2 = ai2->ai_next; + ai2 = ai2->ai_next; } return (0); @@ -356,36 +356,36 @@ addrinfo_test_correctness(struct addrinf printf("testing correctness with the following data:\n"); dump_addrinfo(ai); } - + if (ai == NULL) goto errfin; - + if (!((ai->ai_family >= 0) && (ai->ai_family < AF_MAX))) goto errfin; - + if ((ai->ai_socktype != 0) && (ai->ai_socktype != SOCK_STREAM) && (ai->ai_socktype != SOCK_DGRAM) && (ai->ai_socktype != SOCK_RAW)) goto errfin; - + if ((ai->ai_protocol != 0) && (ai->ai_protocol != IPPROTO_UDP) && (ai->ai_protocol != IPPROTO_TCP)) goto errfin; - + if ((ai->ai_flags & ~(AI_CANONNAME | AI_NUMERICHOST | AI_PASSIVE)) != 0) goto errfin; - if ((ai->ai_addrlen != ai->ai_addr->sa_len) || + if ((ai->ai_addrlen != ai->ai_addr->sa_len) || (ai->ai_family != ai->ai_addr->sa_family)) goto errfin; - + if (debug) printf("correct\n"); - - return (0); + + return (0); errfin: if (debug) printf("incorrect\n"); - + return (-1); } @@ -393,27 +393,27 @@ static int addrinfo_read_hostlist_func(struct addrinfo *ai, char *line) { struct addrinfo *result; - int rv; - + int rv; + if (debug) printf("resolving %s: ", line); rv = getaddrinfo(line, NULL, &hints, &result); if (rv == 0) { if (debug) printf("found\n"); - + rv = addrinfo_test_correctness(result, NULL); if (rv != 0) { freeaddrinfo(result); return (rv); } - + clone_addrinfo(ai, result); freeaddrinfo(result); } else { if (debug) printf("not found\n"); - + memset(ai, 0, sizeof(struct addrinfo)); } return (0); @@ -435,10 +435,10 @@ main(int argc, char **argv) char *snapshot_file, *hostlist_file; int rv; int c; - + if (argc < 2) usage(); - + snapshot_file = NULL; hostlist_file = NULL; memset(&hints, 0, sizeof(struct addrinfo)); @@ -465,38 +465,38 @@ main(int argc, char **argv) default: usage(); } - + TEST_DATA_INIT(addrinfo, &td, clone_addrinfo, free_addrinfo); TEST_DATA_INIT(addrinfo, &td_snap, clone_addrinfo, free_addrinfo); - + if (hostlist_file == NULL) usage(); - + if (access(hostlist_file, R_OK) != 0) { if (debug) printf("can't access the hostlist file %s\n", hostlist_file); - + usage(); } - + if (debug) printf("building host lists from %s\n", hostlist_file); - + rv = TEST_SNAPSHOT_FILE_READ(addrinfo, hostlist_file, &td, addrinfo_read_hostlist_func); if (rv != 0) goto fin; - + if (snapshot_file != NULL) { - if (access(snapshot_file, W_OK | R_OK) != 0) { + if (access(snapshot_file, W_OK | R_OK) != 0) { if (errno == ENOENT) method = TEST_BUILD_SNAPSHOT; else { if (debug) printf("can't access the snapshot file %s\n", snapshot_file); - + rv = -1; goto fin; } @@ -510,7 +510,7 @@ main(int argc, char **argv) } } } - + switch (method) { case TEST_GETADDRINFO: if (snapshot_file != NULL) @@ -519,7 +519,7 @@ main(int argc, char **argv) break; case TEST_BUILD_SNAPSHOT: if (snapshot_file != NULL) { - rv = TEST_SNAPSHOT_FILE_WRITE(addrinfo, snapshot_file, &td, + rv = TEST_SNAPSHOT_FILE_WRITE(addrinfo, snapshot_file, &td, sdump_addrinfo); } break; Modified: stable/10/tools/regression/lib/libc/nss/test-getgr.c ============================================================================== --- stable/10/tools/regression/lib/libc/nss/test-getgr.c Fri Dec 4 09:10:49 2015 (r291758) +++ stable/10/tools/regression/lib/libc/nss/test-getgr.c Fri Dec 4 09:18:12 2015 (r291759) @@ -63,14 +63,14 @@ static void free_group(struct group *); static void sdump_group(struct group *, char *, size_t); static int group_read_snapshot_func(struct group *, char *); -static int group_check_ambiguity(struct group_test_data *, +static int group_check_ambiguity(struct group_test_data *, struct group *); static int group_fill_test_data(struct group_test_data *); static int group_test_correctness(struct group *, void *); static int group_test_getgrnam(struct group *, void *); static int group_test_getgrgid(struct group *, void *); static int group_test_getgrent(struct group *, void *); - + static void usage(void) __attribute__((__noreturn__)); IMPLEMENT_TEST_DATA(group) @@ -83,33 +83,33 @@ clone_group(struct group *dest, struct g { assert(dest != NULL); assert(src != NULL); - + char **cp; int members_num; - + memset(dest, 0, sizeof(struct group)); - + if (src->gr_name != NULL) { dest->gr_name = strdup(src->gr_name); assert(dest->gr_name != NULL); } - + if (src->gr_passwd != NULL) { dest->gr_passwd = strdup(src->gr_passwd); assert(dest->gr_passwd != NULL); } dest->gr_gid = src->gr_gid; - + if (src->gr_mem != NULL) { members_num = 0; for (cp = src->gr_mem; *cp; ++cp) ++members_num; - + dest->gr_mem = (char **)malloc( (members_num + 1) * (sizeof(char *))); assert(dest->gr_mem != NULL); memset(dest->gr_mem, 0, (members_num+1) * (sizeof(char *))); - + for (cp = src->gr_mem; *cp; ++cp) { dest->gr_mem[cp - src->gr_mem] = strdup(*cp); assert(dest->gr_mem[cp - src->gr_mem] != NULL); @@ -117,52 +117,52 @@ clone_group(struct group *dest, struct g } } -static void +static void free_group(struct group *grp) { char **cp; - + assert(grp != NULL); - + free(grp->gr_name); free(grp->gr_passwd); - + for (cp = grp->gr_mem; *cp; ++cp) free(*cp); free(grp->gr_mem); } -static int +static int compare_group(struct group *grp1, struct group *grp2, void *mdata) { char **c1, **c2; - + if (grp1 == grp2) return (0); - + if ((grp1 == NULL) || (grp2 == NULL)) goto errfin; - + if ((strcmp(grp1->gr_name, grp2->gr_name) != 0) || (strcmp(grp1->gr_passwd, grp2->gr_passwd) != 0) || (grp1->gr_gid != grp2->gr_gid)) goto errfin; - + c1 = grp1->gr_mem; c2 = grp2->gr_mem; - + if ((grp1->gr_mem == NULL) || (grp2->gr_mem == NULL)) goto errfin; - + for (;*c1 && *c2; ++c1, ++c2) if (strcmp(*c1, *c2) != 0) goto errfin; - + if ((*c1 != '\0') || (*c2 != '\0')) goto errfin; - + return 0; - + errfin: if ((debug) && (mdata == NULL)) { printf("following structures are not equal:\n"); @@ -178,14 +178,14 @@ sdump_group(struct group *grp, char *buf { char **cp; int written; - + written = snprintf(buffer, buflen, "%s %s %d", - grp->gr_name, grp->gr_passwd, grp->gr_gid); + grp->gr_name, grp->gr_passwd, grp->gr_gid); buffer += written; if (written > buflen) return; buflen -= written; - + if (grp->gr_mem != NULL) { if (*(grp->gr_mem) != '\0') { for (cp = grp->gr_mem; *cp; ++cp) { @@ -194,9 +194,9 @@ sdump_group(struct group *grp, char *buf if (written > buflen) return; buflen -= written; - + if (buflen == 0) - return; + return; } } else snprintf(buffer, buflen, " nomem"); @@ -213,7 +213,7 @@ group_read_snapshot_func(struct group *g if (debug) printf("1 line read from snapshot:\n%s\n", line); - + i = 0; sl = NULL; ps = line; @@ -243,10 +243,10 @@ group_read_snapshot_func(struct group *g if (sl == NULL) { if (strcmp(s, "(null)") == 0) return (0); - + sl = sl_init(); assert(sl != NULL); - + if (strcmp(s, "nomem") != 0) { ts = strdup(s); assert(ts != NULL); @@ -257,7 +257,7 @@ group_read_snapshot_func(struct group *g assert(ts != NULL); sl_add(sl, ts); } - break; + break; }; ++i; } @@ -268,16 +268,16 @@ group_read_snapshot_func(struct group *g memset(grp, 0, sizeof(struct group)); return (-1); } - + sl_add(sl, NULL); grp->gr_mem = sl->sl_str; /* NOTE: is it a dirty hack or not? */ - free(sl); + free(sl); return (0); } -static void +static void dump_group(struct group *result) { if (result != NULL) { @@ -292,7 +292,7 @@ static int group_fill_test_data(struct group_test_data *td) { struct group *grp; - + setgroupent(1); while ((grp = getgrent()) != NULL) { if (group_test_correctness(grp, NULL) == 0) @@ -301,7 +301,7 @@ group_fill_test_data(struct group_test_d return (-1); } endgrent(); - + return (0); } @@ -312,37 +312,37 @@ group_test_correctness(struct group *grp printf("testing correctness with the following data:\n"); dump_group(grp); } - + if (grp == NULL) goto errfin; - + if (grp->gr_name == NULL) goto errfin; - + if (grp->gr_passwd == NULL) goto errfin; - + if (grp->gr_mem == NULL) goto errfin; - + if (debug) printf("correct\n"); - - return (0); + + return (0); errfin: if (debug) printf("incorrect\n"); - + return (-1); } /* group_check_ambiguity() is needed here because when doing the getgrent() - * calls sequence, records from different nsswitch sources can be different, + * calls sequence, records from different nsswitch sources can be different, * though having the same pw_name/pw_uid */ static int group_check_ambiguity(struct group_test_data *td, struct group *pwd) { - + return (TEST_DATA_FIND(group, td, pwd, compare_group, NULL) != NULL ? 0 : -1); } @@ -351,7 +351,7 @@ static int group_test_getgrnam(struct group *grp_model, void *mdata) { struct group *grp; - + if (debug) { printf("testing getgrnam() with the following data:\n"); dump_group(grp_model); @@ -360,20 +360,20 @@ group_test_getgrnam(struct group *grp_mo grp = getgrnam(grp_model->gr_name); if (group_test_correctness(grp, NULL) != 0) goto errfin; - + if ((compare_group(grp, grp_model, NULL) != 0) && - (group_check_ambiguity((struct group_test_data *)mdata, grp) + (group_check_ambiguity((struct group_test_data *)mdata, grp) !=0)) goto errfin; - + if (debug) printf("ok\n"); return (0); - + errfin: if (debug) printf("not ok\n"); - + return (-1); } @@ -381,14 +381,14 @@ static int group_test_getgrgid(struct group *grp_model, void *mdata) { struct group *grp; - + if (debug) { printf("testing getgrgid() with the following data...\n"); dump_group(grp_model); - } - + } + grp = getgrgid(grp_model->gr_gid); - if ((group_test_correctness(grp, NULL) != 0) || + if ((group_test_correctness(grp, NULL) != 0) || ((compare_group(grp, grp_model, NULL) != 0) && (group_check_ambiguity((struct group_test_data *)mdata, grp) != 0))) { @@ -402,7 +402,7 @@ group_test_getgrgid(struct group *grp_mo } } -static int +static int group_test_getgrent(struct group *grp, void *mdata) { /* Only correctness can be checked when doing 1-pass test for @@ -426,10 +426,10 @@ main(int argc, char **argv) char *snapshot_file; int rv; int c; - + if (argc < 2) usage(); - + snapshot_file = NULL; while ((c = getopt(argc, argv, "nge2ds:")) != -1) switch (c) { @@ -454,18 +454,18 @@ main(int argc, char **argv) default: usage(); } - + TEST_DATA_INIT(group, &td, clone_group, free_group); TEST_DATA_INIT(group, &td_snap, clone_group, free_group); if (snapshot_file != NULL) { - if (access(snapshot_file, W_OK | R_OK) != 0) { + if (access(snapshot_file, W_OK | R_OK) != 0) { if (errno == ENOENT) method = TEST_BUILD_SNAPSHOT; else { if (debug) printf("can't access the file %s\n", snapshot_file); - + rv = -1; goto fin; } @@ -474,12 +474,12 @@ main(int argc, char **argv) rv = 0; goto fin; } - + TEST_SNAPSHOT_FILE_READ(group, snapshot_file, &td_snap, group_read_snapshot_func); } } - + rv = group_fill_test_data(&td); if (rv == -1) return (-1); @@ -489,7 +489,7 @@ main(int argc, char **argv) rv = DO_1PASS_TEST(group, &td, group_test_getgrnam, (void *)&td); else - rv = DO_1PASS_TEST(group, &td_snap, + rv = DO_1PASS_TEST(group, &td_snap, group_test_getgrnam, (void *)&td_snap); break; case TEST_GETGRGID: @@ -497,7 +497,7 @@ main(int argc, char **argv) rv = DO_1PASS_TEST(group, &td, group_test_getgrgid, (void *)&td); else - rv = DO_1PASS_TEST(group, &td_snap, + rv = DO_1PASS_TEST(group, &td_snap, group_test_getgrgid, (void *)&td_snap); break; case TEST_GETGRENT: @@ -510,7 +510,7 @@ main(int argc, char **argv) break; case TEST_GETGRENT_2PASS: TEST_DATA_INIT(group, &td_2pass, clone_group, free_group); - rv = group_fill_test_data(&td_2pass); + rv = group_fill_test_data(&td_2pass); if (rv != -1) rv = DO_2PASS_TEST(group, &td, &td_2pass, compare_group, NULL); @@ -518,7 +518,7 @@ main(int argc, char **argv) break; case TEST_BUILD_SNAPSHOT: if (snapshot_file != NULL) - rv = TEST_SNAPSHOT_FILE_WRITE(group, snapshot_file, &td, + rv = TEST_SNAPSHOT_FILE_WRITE(group, snapshot_file, &td, sdump_group); break; default: @@ -529,6 +529,6 @@ main(int argc, char **argv) fin: TEST_DATA_DESTROY(group, &td_snap); TEST_DATA_DESTROY(group, &td); - free(snapshot_file); + free(snapshot_file); return (rv); } Modified: stable/10/tools/regression/lib/libc/nss/test-gethostby.c ============================================================================== --- stable/10/tools/regression/lib/libc/nss/test-gethostby.c Fri Dec 4 09:10:49 2015 (r291758) +++ stable/10/tools/regression/lib/libc/nss/test-gethostby.c Fri Dec 4 09:18:12 2015 (r291759) @@ -90,7 +90,7 @@ static int hostent_test_correctness(stru static int hostent_test_gethostbyaddr(struct hostent *, void *); static int hostent_test_getaddrinfo_eq(struct hostent *, void *); static int hostent_test_getnameinfo_eq(struct hostent *, void *); - + static void usage(void) __attribute__((__noreturn__)); IMPLEMENT_TEST_DATA(hostent) @@ -103,7 +103,7 @@ __gethostbyname2(const char *name, int a { struct hostent *he; int error; - + if (use_ipnode_functions == 0) he = gethostbyname2(name, af); else { @@ -112,7 +112,7 @@ __gethostbyname2(const char *name, int a if (he == NULL); errno = error; } - + return (he); } @@ -121,7 +121,7 @@ __gethostbyaddr(const void *addr, sockle { struct hostent *he; int error; - + if (use_ipnode_functions == 0) he = gethostbyaddr(addr, len, af); else { @@ -130,8 +130,8 @@ __gethostbyaddr(const void *addr, sockle if (he == NULL) errno = error; } - - return (he); + + return (he); } static void @@ -147,44 +147,44 @@ clone_hostent(struct hostent *dest, stru { assert(dest != NULL); assert(src != NULL); - + char **cp; int aliases_num; int addrs_num; size_t offset; - + memset(dest, 0, sizeof(struct hostent)); - + if (src->h_name != NULL) { dest->h_name = strdup(src->h_name); assert(dest->h_name != NULL); } - + dest->h_addrtype = src->h_addrtype; dest->h_length = src->h_length; - + if (src->h_aliases != NULL) { aliases_num = 0; for (cp = src->h_aliases; *cp; ++cp) ++aliases_num; - + dest->h_aliases = (char **)malloc((aliases_num + 1) * (sizeof(char *))); assert(dest->h_aliases != NULL); memset(dest->h_aliases, 0, (aliases_num + 1) * (sizeof(char *))); - + for (cp = src->h_aliases; *cp; ++cp) { dest->h_aliases[cp - src->h_aliases] = strdup(*cp); assert(dest->h_aliases[cp - src->h_aliases] != NULL); } } - + if (src->h_addr_list != NULL) { addrs_num = 0; for (cp = src->h_addr_list; *cp; ++cp) ++addrs_num; - + dest->h_addr_list = (char **)malloc((addrs_num + 1) * (sizeof(char *))); assert(dest->h_addr_list != NULL); @@ -193,7 +193,7 @@ clone_hostent(struct hostent *dest, stru for (cp = src->h_addr_list; *cp; ++cp) { offset = cp - src->h_addr_list; - dest->h_addr_list[offset] = + dest->h_addr_list[offset] = (char *)malloc(src->h_length); assert(dest->h_addr_list[offset] != NULL); memcpy(dest->h_addr_list[offset], @@ -202,15 +202,15 @@ clone_hostent(struct hostent *dest, stru } } -static void +static void free_hostent(struct hostent *ht) { char **cp; - + assert(ht != NULL); - + free(ht->h_name); - + if (ht->h_aliases != NULL) { for (cp = ht->h_aliases; *cp; ++cp) free(*cp); @@ -224,33 +224,33 @@ free_hostent(struct hostent *ht) } } -static int +static int compare_hostent(struct hostent *ht1, struct hostent *ht2, void *mdata) { char **c1, **c2, **ct, **cb; int b; - + if (ht1 == ht2) return 0; - + if ((ht1 == NULL) || (ht2 == NULL)) *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***