annotate lib/spawn_faction_init.c @ 40140:81f075eaa990

ptsname_r: Work around bug on Android 4.3. * m4/ptsname_r.m4 (gl_FUNC_PTSNAME_R): Define HAVE_ESSENTIALLY_WORKING_PTSNAME_R. Test whether the return value is correct. * lib/ptsname_r.c (__ptsname_r): If HAVE_ESSENTIALLY_WORKING_PTSNAME_R is defined, just fix the return value. * doc/glibc-functions/ptsname_r.texi: Mention the Android bug. Reword: The behaviour of musl libc is nothing to be "fixed", since it is compliant with the next POSIX standard.
author Bruno Haible <bruno@clisp.org>
date Sat, 26 Jan 2019 15:23:19 +0100
parents b06060465f09
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 19484
diff changeset
1 /* Copyright (C) 2000, 2009-2019 Free Software Foundation, Inc.
10506
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 This file is part of the GNU C Library.
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 This program is free software: you can redistribute it and/or modify
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 the Free Software Foundation; either version 3 of the License, or
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 (at your option) any later version.
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
19190
9759915b2aca all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 18626
diff changeset
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
10506
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 #include <config.h>
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 /* Specification. */
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 #include <spawn.h>
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 #include <errno.h>
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 #include <stdlib.h>
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 #include <string.h>
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 #include "spawn_int.h"
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 /* Function used to increase the size of the allocated array. This
16235
18a38c9615f0 In commentary, do not use ` to quote.
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
30 function is called from the 'add'-functions. */
10506
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 int
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 __posix_spawn_file_actions_realloc (posix_spawn_file_actions_t *file_actions)
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 {
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 int newalloc = file_actions->_allocated + 8;
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 void *newmem = realloc (file_actions->_actions,
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10506
diff changeset
36 newalloc * sizeof (struct __spawn_action));
10506
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 if (newmem == NULL)
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 /* Not enough memory. */
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 return ENOMEM;
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 file_actions->_actions = (struct __spawn_action *) newmem;
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 file_actions->_allocated = newalloc;
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 return 0;
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 }
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48
16235
18a38c9615f0 In commentary, do not use ` to quote.
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
49 /* Initialize data structure for file attribute for 'spawn' call. */
10506
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 int
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 posix_spawn_file_actions_init (posix_spawn_file_actions_t *file_actions)
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 {
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 /* Simply clear all the elements. */
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 memset (file_actions, '\0', sizeof (*file_actions));
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 return 0;
989d25db0548 New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 }