diff options
author | Thomas Haller <thaller@redhat.com> | 2023-03-28 11:02:32 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2023-04-03 10:27:43 +0200 |
commit | b5875ec79ee245a0576c8f3db252273b5aa1dd33 (patch) | |
tree | 3d67c635266c2d6f4963b3039d929f96ec6bcaa0 | |
parent | a26c79e49593fdab4d3693f9c0835320d44fe8c4 (diff) | |
download | NetworkManager-b5875ec79ee245a0576c8f3db252273b5aa1dd33.tar.gz |
core: use nm_clear_fd() helper in nm_utils_spawn_helper()
-rw-r--r-- | src/core/nm-core-utils.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/core/nm-core-utils.c b/src/core/nm-core-utils.c index 2686deef96..4ee0d12322 100644 --- a/src/core/nm-core-utils.c +++ b/src/core/nm-core-utils.c @@ -4913,13 +4913,9 @@ helper_info_free(gpointer data) nm_clear_g_source_inst(&info->input_source); nm_clear_g_source_inst(&info->output_source); nm_clear_g_source_inst(&info->error_source); - - if (info->child_stdout != -1) - nm_close(info->child_stdout); - if (info->child_stdin != -1) - nm_close(info->child_stdin); - if (info->child_stderr != -1) - nm_close(info->child_stderr); + nm_clear_fd(&info->child_stdout); + nm_clear_fd(&info->child_stdin); + nm_clear_fd(&info->child_stderr); if (info->pid != -1) { nm_assert(info->pid > 1); @@ -5015,8 +5011,7 @@ helper_have_data(int fd, GIOCondition condition, gpointer user_data) return G_SOURCE_CONTINUE; nm_clear_g_source_inst(&info->input_source); - nm_close(info->child_stdout); - info->child_stdout = -1; + nm_clear_fd(&info->child_stdout); _LOG2T(info, "stdout closed"); @@ -5044,9 +5039,7 @@ helper_have_err_data(int fd, GIOCondition condition, gpointer user_data) return G_SOURCE_CONTINUE; nm_clear_g_source_inst(&info->error_source); - nm_close(info->child_stderr); - info->child_stderr = -1; - + nm_clear_fd(&info->child_stderr); return G_SOURCE_CONTINUE; } |