Page MenuHomeFreeBSD

D26278.diff
No OneTemporary

D26278.diff

Index: head/lib/libc/tests/resolv/resolv_test.c
===================================================================
--- head/lib/libc/tests/resolv/resolv_test.c
+++ head/lib/libc/tests/resolv/resolv_test.c
@@ -70,22 +70,23 @@
load(const char *fname)
{
FILE *fp;
- size_t len;
+ size_t linecap;
char *line;
- if ((fp = fopen(fname, "r")) == NULL)
+ fp = fopen(fname, "r");
ATF_REQUIRE(fp != NULL);
- while ((line = fgetln(fp, &len)) != NULL) {
- char c = line[len - 1];
+ line = NULL;
+ linecap = 0;
+ while (getline(&line, &linecap, fp) >= 0) {
char *ptr;
- line[len - 1] = '\0';
+
for (ptr = strtok(line, WS); ptr; ptr = strtok(NULL, WS)) {
- if (ptr == '\0' || ptr[0] == '#')
- continue;
+ if (ptr[0] == '#')
+ break;
sl_add(hosts, strdup(ptr));
}
- line[len - 1] = c;
}
+ free(line);
(void)fclose(fp);
}

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 20, 12:34 PM (7 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14738525
Default Alt Text
D26278.diff (850 B)

Event Timeline