|
Packit Service |
c3aa71 |
/* Copyright (C) 2000, 2009-2015 Free Software Foundation, Inc.
|
|
Packit Service |
c3aa71 |
This file is part of the GNU C Library.
|
|
Packit Service |
c3aa71 |
|
|
Packit Service |
c3aa71 |
This program is free software: you can redistribute it and/or modify
|
|
Packit Service |
c3aa71 |
it under the terms of the GNU General Public License as published by
|
|
Packit Service |
c3aa71 |
the Free Software Foundation; either version 3 of the License, or
|
|
Packit Service |
c3aa71 |
(at your option) any later version.
|
|
Packit Service |
c3aa71 |
|
|
Packit Service |
c3aa71 |
This program is distributed in the hope that it will be useful,
|
|
Packit Service |
c3aa71 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
c3aa71 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
c3aa71 |
GNU General Public License for more details.
|
|
Packit Service |
c3aa71 |
|
|
Packit Service |
c3aa71 |
You should have received a copy of the GNU General Public License
|
|
Packit Service |
c3aa71 |
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
Packit Service |
c3aa71 |
|
|
Packit Service |
c3aa71 |
#include <config.h>
|
|
Packit Service |
c3aa71 |
|
|
Packit Service |
c3aa71 |
/* Specification. */
|
|
Packit Service |
c3aa71 |
#include <spawn.h>
|
|
Packit Service |
c3aa71 |
|
|
Packit Service |
c3aa71 |
#include <errno.h>
|
|
Packit Service |
c3aa71 |
#include <stdlib.h>
|
|
Packit Service |
c3aa71 |
#include <string.h>
|
|
Packit Service |
c3aa71 |
|
|
Packit Service |
c3aa71 |
#include "spawn_int.h"
|
|
Packit Service |
c3aa71 |
|
|
Packit Service |
c3aa71 |
|
|
Packit Service |
c3aa71 |
/* Function used to increase the size of the allocated array. This
|
|
Packit Service |
c3aa71 |
function is called from the 'add'-functions. */
|
|
Packit Service |
c3aa71 |
int
|
|
Packit Service |
c3aa71 |
__posix_spawn_file_actions_realloc (posix_spawn_file_actions_t *file_actions)
|
|
Packit Service |
c3aa71 |
{
|
|
Packit Service |
c3aa71 |
int newalloc = file_actions->_allocated + 8;
|
|
Packit Service |
c3aa71 |
void *newmem = realloc (file_actions->_actions,
|
|
Packit Service |
c3aa71 |
newalloc * sizeof (struct __spawn_action));
|
|
Packit Service |
c3aa71 |
|
|
Packit Service |
c3aa71 |
if (newmem == NULL)
|
|
Packit Service |
c3aa71 |
/* Not enough memory. */
|
|
Packit Service |
c3aa71 |
return ENOMEM;
|
|
Packit Service |
c3aa71 |
|
|
Packit Service |
c3aa71 |
file_actions->_actions = (struct __spawn_action *) newmem;
|
|
Packit Service |
c3aa71 |
file_actions->_allocated = newalloc;
|
|
Packit Service |
c3aa71 |
|
|
Packit Service |
c3aa71 |
return 0;
|
|
Packit Service |
c3aa71 |
}
|
|
Packit Service |
c3aa71 |
|
|
Packit Service |
c3aa71 |
|
|
Packit Service |
c3aa71 |
/* Initialize data structure for file attribute for 'spawn' call. */
|
|
Packit Service |
c3aa71 |
int
|
|
Packit Service |
c3aa71 |
posix_spawn_file_actions_init (posix_spawn_file_actions_t *file_actions)
|
|
Packit Service |
c3aa71 |
{
|
|
Packit Service |
c3aa71 |
/* Simply clear all the elements. */
|
|
Packit Service |
c3aa71 |
memset (file_actions, '\0', sizeof (*file_actions));
|
|
Packit Service |
c3aa71 |
return 0;
|
|
Packit Service |
c3aa71 |
}
|