mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-01 03:18:26 +08:00
Fix file descriptor leakage from completion pager
darcs-hash:20061112121613-ac50b-209d42c06401faf675ff123236823dcaa651d6f7.gz
This commit is contained in:
parent
80759ee03f
commit
ec43090c16
2
exec.c
2
exec.c
|
@ -704,7 +704,7 @@ void exec( job_t *j )
|
|||
|
||||
if( input_redirect &&
|
||||
(input_redirect->io_mode == IO_BUFFER) &&
|
||||
input_redirect->param3.is_input )
|
||||
input_redirect->is_input )
|
||||
{
|
||||
/*
|
||||
Input redirection - create a new gobetween process to take
|
||||
|
|
12
io.c
12
io.c
|
@ -53,7 +53,6 @@ Utilities for io redirection.
|
|||
|
||||
void io_buffer_read( io_data_t *d )
|
||||
{
|
||||
|
||||
exec_close(d->param1.pipe_fd[1] );
|
||||
|
||||
if( d->io_mode == IO_BUFFER )
|
||||
|
@ -108,7 +107,7 @@ io_data_t *io_buffer_create( int is_input )
|
|||
buffer_redirect->io_mode=IO_BUFFER;
|
||||
buffer_redirect->next=0;
|
||||
buffer_redirect->param2.out_buffer= malloc( sizeof(buffer_t));
|
||||
buffer_redirect->param3.is_input = is_input;
|
||||
buffer_redirect->is_input = is_input;
|
||||
b_init( buffer_redirect->param2.out_buffer );
|
||||
buffer_redirect->fd=is_input?0:1;
|
||||
|
||||
|
@ -136,6 +135,15 @@ io_data_t *io_buffer_create( int is_input )
|
|||
void io_buffer_destroy( io_data_t *io_buffer )
|
||||
{
|
||||
|
||||
/**
|
||||
If this is an input buffer, then io_read_buffer will not have
|
||||
been called, and we need to close the output fd as well.
|
||||
*/
|
||||
if( io_buffer->is_input )
|
||||
{
|
||||
exec_close(io_buffer->param1.pipe_fd[1] );
|
||||
}
|
||||
|
||||
exec_close( io_buffer->param1.pipe_fd[0] );
|
||||
|
||||
/*
|
||||
|
|
9
io.h
9
io.h
|
@ -45,16 +45,7 @@ typedef struct io_data
|
|||
} param2
|
||||
;
|
||||
|
||||
union
|
||||
{
|
||||
/**
|
||||
This will be non-zero if this is a buffer of input, not
|
||||
output
|
||||
*/
|
||||
int is_input;
|
||||
}
|
||||
param3;
|
||||
|
||||
|
||||
/** Pointer to the next IO redirection */
|
||||
struct io_data *next;
|
||||
|
|
Loading…
Reference in New Issue
Block a user