From 1fd0c9b0e1f27098f9bf86e86285335e640317a5 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Fri, 15 Oct 2021 22:39:17 +0200 Subject: util, pasta: Don't read() and lseek() every single line in read_line() ...periodically checking bound ports becomes quite expensive otherwise. Signed-off-by: Stefano Brivio --- conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'conf.c') diff --git a/conf.c b/conf.c index b92a7d9..b91d09b 100644 --- a/conf.c +++ b/conf.c @@ -293,7 +293,7 @@ static void get_dns(struct ctx *c) if ((fd = open("/etc/resolv.conf", O_RDONLY)) < 0) goto out; - while (line_read(buf, BUFSIZ, fd)) { + while (!(*buf = 0) && line_read(buf, BUFSIZ, fd)) { if (!dns_set && strstr(buf, "nameserver ") == buf) { p = strrchr(buf, ' '); if (!p) -- cgit v1.2.3