aboutgitcodebugslistschat
path: root/conf.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-10-15 22:39:17 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-10-16 00:49:33 +0200
commit1fd0c9b0e1f27098f9bf86e86285335e640317a5 (patch)
treefc0f069c77ae83e8c7225f4fbbdd0194a0dcfaea /conf.c
parent14fe73e766206c71ab3c6d5ddc252435c36423bd (diff)
downloadpasst-1fd0c9b0e1f27098f9bf86e86285335e640317a5.tar
passt-1fd0c9b0e1f27098f9bf86e86285335e640317a5.tar.gz
passt-1fd0c9b0e1f27098f9bf86e86285335e640317a5.tar.bz2
passt-1fd0c9b0e1f27098f9bf86e86285335e640317a5.tar.lz
passt-1fd0c9b0e1f27098f9bf86e86285335e640317a5.tar.xz
passt-1fd0c9b0e1f27098f9bf86e86285335e640317a5.tar.zst
passt-1fd0c9b0e1f27098f9bf86e86285335e640317a5.zip
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 <sbrivio@redhat.com>
Diffstat (limited to 'conf.c')
-rw-r--r--conf.c2
1 files changed, 1 insertions, 1 deletions
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)