annotate lib/spawnattr_getsigmask.c @ 12246:b156d2d1b827

freopen-safer: new module * modules/freopen-safer: New module. * m4/stdio-safer.m4 (gl_FREOPEN_SAFER): New macro. * lib/freopen-safer.c (freopen_safer): New file. * lib/stdio-safer.h (freopen_safer): New declaration. * lib/stdio--.h (freopen): New override. * MODULES.html.sh (File stream based Input/Output): Mention it. * doc/posix-functions/freopen.texi (freopen): Mention pitfalls and freopen-safer module. * doc/posix-functions/stderr.texi (stderr): Likewise. * doc/posix-functions/stdin.texi (stdin): Likewise. * doc/posix-functions/stdout.texi (stdout): Likewise. * modules/freopen-safer-tests: New test. * tests/test-reopen-safer.c: New file. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Thu, 05 Nov 2009 15:13:00 -0700
parents ef9027b99a37
children e8d2c6fc33ad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10522
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Copyright (C) 2000 Free Software Foundation, Inc.
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 This file is part of the GNU C Library.
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 This program is free software: you can redistribute it and/or modify
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 the Free Software Foundation; either version 3 of the License, or
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 (at your option) any later version.
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 #include <config.h>
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 /* Specification. */
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 #include <spawn.h>
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 #include <string.h>
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 /* Store signal mask for the new process from ATTR in SIGMASK. */
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 int
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 posix_spawnattr_getsigmask (const posix_spawnattr_t *attr,
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 sigset_t *sigmask)
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 {
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 /* Copy the sigset_t data to the user buffer. */
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 memcpy (sigmask, &attr->_ss, sizeof (sigset_t));
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 return 0;
ef9027b99a37 New module 'posix_spawnattr_getsigmask'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 }