1 /* Test that sigprocmask does not read from the unused part of jmpbuf.
2 Copyright (C) 2017-2019 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
24 #include <support/next_to_fault.h>
26 #define SIZEOF_SIGSET_T sizeof (__jmp_buf_sigset_t)
32 struct support_next_to_fault sigset_t_buf
33 = support_next_to_fault_allocate (SIZEOF_SIGSET_T
);
34 sigset_t
*m_p
= (sigset_t
*) sigset_t_buf
.buffer
;
38 memcpy (m_p
, &m
, SIZEOF_SIGSET_T
);
39 sigprocmask (SIG_SETMASK
, m_p
, NULL
);
40 memcpy (&m
, m_p
, SIZEOF_SIGSET_T
);
41 if (sigsetjmp (sj
, 0) == 0)
43 sigaddset (&m
, SIGUSR1
);
44 memcpy (m_p
, &m
, SIZEOF_SIGSET_T
);
45 sigprocmask (SIG_SETMASK
, m_p
, NULL
);
46 memcpy (&m
, m_p
, SIZEOF_SIGSET_T
);
50 sigprocmask (SIG_SETMASK
, NULL
, m_p
);
51 memcpy (&m
, m_p
, SIZEOF_SIGSET_T
);
52 return sigismember (&m
, SIGUSR1
) ? EXIT_SUCCESS
: EXIT_FAILURE
;
55 #include <support/test-driver.c>