Don't print errors from the DHCP endpoint

This commit is contained in:
reykfloeter 2019-06-02 03:13:58 +02:00
parent 139f35d9d4
commit 63935a1b5f

View file

@ -36,6 +36,8 @@ tryendpoint(struct system_config *sc,
int (fetch)(struct system_config *), int (fetch)(struct system_config *),
int (next)(struct system_config *)) int (next)(struct system_config *))
{ {
int errfd = -1, ret;
free(sc->sc_endpoint); free(sc->sc_endpoint);
sc->sc_endpoint = NULL; sc->sc_endpoint = NULL;
@ -59,7 +61,10 @@ tryendpoint(struct system_config *sc,
return (*next)(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 tryendpoint(sc, fetch, next);
return (0); return (0);