Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102987030
D26278.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
850 B
Referenced Files
None
Subscribers
None
D26278.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D26278: Various fixes to the load() function.
Attached
Detach File
Event Timeline
Log In to Comment