From: Tobias Brunner Date: Fri, 28 Sep 2012 15:33:24 +0000 (+0200) Subject: Ensure that pipe is closed when calling resolvconf(8) X-Git-Tag: 5.0.1~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=53ab3c27cdc03f03906dd0170c12c9039ef66fc3;p=thirdparty%2Fstrongswan.git Ensure that pipe is closed when calling resolvconf(8) --- diff --git a/src/libhydra/plugins/resolve/resolve_handler.c b/src/libhydra/plugins/resolve/resolve_handler.c index 2bee45d0d9..0a3094fd7c 100644 --- a/src/libhydra/plugins/resolve/resolve_handler.c +++ b/src/libhydra/plugins/resolve/resolve_handler.c @@ -150,6 +150,7 @@ static bool invoke_resolvconf(private_resolve_handler_t *this, bool install) { char cmd[128]; + bool success = TRUE; /* we use the nameserver's IP address as part of the interface name to * make them unique */ @@ -171,7 +172,8 @@ static bool invoke_resolvconf(private_resolve_handler_t *this, DBG1(DBG_IKE, "installing DNS server %H via resolvconf", addr); fprintf(out, "nameserver %H # by strongSwan, from %Y\n", addr, server); - if (ferror(out) || pclose(out)) + success = !ferror(out); + if (pclose(out)) { return FALSE; } @@ -180,7 +182,7 @@ static bool invoke_resolvconf(private_resolve_handler_t *this, { ignore_result(system(cmd)); } - return TRUE; + return success; } METHOD(attribute_handler_t, handle, bool,