summaryrefslogtreecommitdiff
path: root/lib/libc/tests/resolv/resolv_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/tests/resolv/resolv_test.c')
-rw-r--r--lib/libc/tests/resolv/resolv_test.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/tests/resolv/resolv_test.c b/lib/libc/tests/resolv/resolv_test.c
index 1da42e3bcd18..6668ad722e0c 100644
--- a/lib/libc/tests/resolv/resolv_test.c
+++ b/lib/libc/tests/resolv/resolv_test.c
@@ -76,15 +76,15 @@ load(const char *fname)
if ((fp = fopen(fname, "r")) == NULL)
ATF_REQUIRE(fp != NULL);
while ((line = fgetln(fp, &len)) != NULL) {
- char c = line[len];
+ char c = line[len - 1];
char *ptr;
- line[len] = '\0';
+ line[len - 1] = '\0';
for (ptr = strtok(line, WS); ptr; ptr = strtok(NULL, WS)) {
if (ptr == '\0' || ptr[0] == '#')
continue;
sl_add(hosts, strdup(ptr));
}
- line[len] = c;
+ line[len - 1] = c;
}
(void)fclose(fp);