mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
change the semantics of spawn_cb routine.
-- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
729951f4c2
commit
4736debd01
4 changed files with 19 additions and 75 deletions
|
@ -302,35 +302,11 @@ copy_buffer_flush (struct copy_buffer *c, estream_t sink)
|
|||
|
||||
|
||||
static int
|
||||
close_all_except (struct spawn_cb_arg *arg)
|
||||
close_all_except (void *arg)
|
||||
{
|
||||
int except[32];
|
||||
int i = 0;
|
||||
int fd_in = arg->std_fds[0];
|
||||
int fd_out = arg->std_fds[1];
|
||||
int fd_err = arg->std_fds[2];
|
||||
int *exceptclose = arg->arg;
|
||||
int *exceptclose = arg;
|
||||
|
||||
if (fd_in >= 0)
|
||||
except[i++] = fd_in;
|
||||
if (fd_out >= 0)
|
||||
except[i++] = fd_out;
|
||||
if (fd_err >= 0)
|
||||
except[i++] = fd_err;
|
||||
|
||||
for (; i < 31; i++)
|
||||
{
|
||||
int fd = *exceptclose++;
|
||||
|
||||
if (fd < 0)
|
||||
break;
|
||||
else
|
||||
except[i] = fd;
|
||||
}
|
||||
|
||||
except[i++] = -1;
|
||||
|
||||
close_all_fds (3, except);
|
||||
close_all_fds (3, exceptclose);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue