From 63935a1b5f2c4d20b7d4629d97b236453cd3edb1 Mon Sep 17 00:00:00 2001 From: Reyk Floeter Date: Sun, 2 Jun 2019 03:13:58 +0200 Subject: [PATCH] Don't print errors from the DHCP endpoint --- agent/cloudinit.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/agent/cloudinit.c b/agent/cloudinit.c index aff28d6..75b28e7 100644 --- a/agent/cloudinit.c +++ b/agent/cloudinit.c @@ -36,6 +36,8 @@ tryendpoint(struct system_config *sc, int (fetch)(struct system_config *), int (next)(struct system_config *)) { + int errfd = -1, ret; + free(sc->sc_endpoint); sc->sc_endpoint = NULL; @@ -59,7 +61,10 @@ tryendpoint(struct system_config *sc, return (*next)(sc); } - if ((*fetch)(sc) != 0) + errfd = disable_output(sc, STDERR_FILENO); + ret = (*fetch)(sc); + enable_output(sc, STDERR_FILENO, errfd); + if (ret != 0) return tryendpoint(sc, fetch, next); return (0);