[4/5] copy_and_spawn_sgid: Avoid double calls to close()
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
Commit Message
If close() on infd and outfd succeeded, reset the fd numbers so that
we don't attempt to close them again.
---
support/support_capture_subprocess.c | 1 +
1 file changed, 1 insertion(+)
Comments
Hi Siddhesh,
> If close() on infd and outfd succeeded, reset the fd numbers so that
> we don't attempt to close them again.
> ---
> support/support_capture_subprocess.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/support/support_capture_subprocess.c b/support/support_capture_subprocess.c
> index 27bfd19c93..0bacf6dbc2 100644
> --- a/support/support_capture_subprocess.c
> +++ b/support/support_capture_subprocess.c
> @@ -170,6 +170,7 @@ copy_and_spawn_sgid (char *child_id, gid_t gid)
> support_subprogram because we only want the program exit status, not the
> contents. */
> ret = 0;
> + infd = outfd = -1;
>
> char * const args[] = {execname, child_id, NULL};
Looks good to me.
infd and outfd are indeed close'd above, and close'd again below if they are
non-negative. Setting to -1 ensures that we won't attempt to close them again.
Reviewed-by: Arjun Shankar <arjun@redhat.com>
Cheers!
@@ -170,6 +170,7 @@ copy_and_spawn_sgid (char *child_id, gid_t gid)
support_subprogram because we only want the program exit status, not the
contents. */
ret = 0;
+ infd = outfd = -1;
char * const args[] = {execname, child_id, NULL};