conf: Always pass an empty buffer to line_read() in get_dns()
Given that get_dns() touches the buffer read by line_read(), we can't optimise that by passing the existing buffer. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
b0b77118fe
commit
7d24803fb3
1 changed files with 1 additions and 2 deletions
3
conf.c
3
conf.c
|
@ -293,8 +293,7 @@ static void get_dns(struct ctx *c)
|
||||||
if ((fd = open("/etc/resolv.conf", O_RDONLY)) < 0)
|
if ((fd = open("/etc/resolv.conf", O_RDONLY)) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
*buf = 0;
|
while (!(*buf = 0) && line_read(buf, BUFSIZ, fd)) {
|
||||||
while (line_read(buf, BUFSIZ, fd)) {
|
|
||||||
if (!dns_set && strstr(buf, "nameserver ") == buf) {
|
if (!dns_set && strstr(buf, "nameserver ") == buf) {
|
||||||
p = strrchr(buf, ' ');
|
p = strrchr(buf, ' ');
|
||||||
if (!p)
|
if (!p)
|
||||||
|
|
Loading…
Reference in a new issue