From beef9f736c304a81a6119661e8f6d66ae180daf6 Mon Sep 17 00:00:00 2001 From: Reyk Floeter Date: Fri, 29 Nov 2019 17:06:39 +0000 Subject: [PATCH] Append /etc/resolv.conf.tail if it exists --- CHANGELOG.md | 5 +++++ agent/main.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9802c72..00ad555 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## v1.0 (2019-11-29) + +* Append `/etc/resolv.conf.tail` to `/etc/resolv.conf` if it exists. +* Fixed usage. + ## v0.9 (2019-06-26) * Added support for `-c` to specify the probing order of different cloud stacks. diff --git a/agent/main.c b/agent/main.c index 6b15b6a..2c83270 100644 --- a/agent/main.c +++ b/agent/main.c @@ -838,7 +838,7 @@ agent_network(struct system_config *sc) const char *family; char domain[(NI_MAXHOST + 1) * 6 + 8]; /* up to 6 domains */ int has_domain = 0; - char ifidx[UINT16_MAX]; + char ifidx[UINT16_MAX], *str; const char *comment = "# Generated by cloud-agent"; if (!sc->sc_network) @@ -907,6 +907,12 @@ agent_network(struct system_config *sc) if (has_domain) fileout(domain, "a", "/etc/resolv.conf"); + /* append resolv.conf.tail if it exists */ + if ((str = filein("r", "/etc/resolv.conf.tail")) != NULL) { + fileout(str, "a", "/etc/resolv.conf"); + free(str); + } + return (0); }