summaryrefslogtreecommitdiff
path: root/modules/c-stack
Commit message (Collapse)AuthorAgeFilesLines
* c-stack: depend on inttypes, mempcpyPaul Eggert2021-08-221-0/+2
| | | | | | * modules/c-stack (Depends-on): Add inttypes, mempcpy. mempcpy problem reported by Evan Miller in: https://debbugs.gnu.org/50098#31
* c-stack: Support catching stack overflow on most platforms without libsigsegv.Bruno Haible2021-05-181-7/+1
| | | | | | | | | | * lib/c-stack.c: Remove all Solaris-specific code. Include <sigsegv.h> always. * m4/c-stack.m4: Remove all Solaris-specific code. (gl_C_STACK): Test $with_libsigsegv from module 'sigsegv'. * modules/c-stack (Files): Remove m4/libsigsegv.m4. (Depends-on): Add sigsegv. Remove havelib, intprops, inttypes, mempcpy, sigaction, stdbool.
* c-stack: Use idx_t for nonnegative ptrdiff_t variables.Bruno Haible2020-12-061-0/+1
| | | | | | * lib/c-stack.c: Include idx.h. (die): Mark buflen as nonnegative. * modules/c-stack (Depends-on): Add idx.
* c-stack: streamline Solaris configurationPaul Eggert2020-10-031-1/+2
| | | | | | | | | | | | * lib/c-stack.c: Omit mention of HAVE_SIGALTSTACK, since the code is used only if a test for sigaltstack worked in some other way. * m4/c-stack.m4 (gl_PREREQ_C_STACK): Do not require gl_LIBSIGSEGV; instead, execute gl_LIBSIGSEGV only if needed (because the XSI heuristic does not work). * modules/c-stack (Files): Add m4/libsigsegv.m4, since we no longer require the libsigsegv module. (Depends-on): Depend on havelib, not libsigsegv.
* c-stack: output diagnostic in single 'write'Paul Eggert2020-09-201-0/+2
| | | | | | | * lib/c-stack.c (die): In the typical case, use just one 'write' syscall to output the diagnostic, as this lessens interleaving. (die, c_stack_action): Assume C99. * modules/c-stack (Depends-on): Add c99, mempcpy.
* c-stack: improve checking if !libsigsegvPaul Eggert2020-09-201-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If SIGINFO_WORKS, do not treat a null pointer dereference as if it were a stack overflow. Use uintptr_t and INT_ADD_WRAPV to avoid unlikely pointer overflow. Also, fix some obsolete code and typos. I found these problems while looking into this bug report: https://lists.gnu.org/r/grep-devel/2020-09/msg00053.html * lib/c-stack.c: Include c-stack.h first, to test interface. Include inttypes.h for UINTPTR_MAX, stdbool.h, stddef.h for max_align_t, intprops.h for INT_ADD_WRAPV. (USE_LIBSIGSEGV): New macro; use it to simplify later code. (SIGSTKSZ): Simplify setup. Work around libsigsegv bug only for libsigsegv 2.8 and earlier since the bug should be fixed after that. (alternate_signal_stack): Use max_align_t instead of doing it by hand. (segv_handler, overflow_handler, segv_handler) [DEBUG]: Assume sprintf returns byte count; this assumption is safe now. (page_size): New static volatile variable, since sysconf isn’t documented to be async-signal-safe on Solaris. This variable is present and used if (!USE_LIBSIGSEGV && HAVE_SIGALTSTACK && HAVE_DECL_SIGALTSTACK && HAVE_STACK_OVERFLOW_HANDLING && SIGINFO_WORKS). (segv_handler): Use it if present. Never report null pointer dereference as a stack overflow. Check for (unlikely) unsigned and/or pointer overflow. * m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Rename cache variables to gl_cv_sys_stack_overflow_works and gl_cv_sys_xsi_stack_overflow_heuristic. All uses changed. (gl_PREREQ_C_STACK): Do not require AC_FUNC_ALLOCA, since c-stack no longer uses STACK_DIRECTION. Do not check for unistd.h, since we depend on unistd. Fix shell typo ‘$"ac_cv_sys_xsi_stack_overflow_heuristic"’. * modules/c-stack (Depends-on): Sort. Add intprops, inttypes, stdbool, stddef.
* Fix some 'Link' sections.Bruno Haible2019-01-041-0/+1
| | | | | | * modules/c-stack (Link): Add link directive from the 'gettext-h' dependency. * modules/getaddrinfo (Link): Likewise.
* Port modules to use getprogname explicitlyPino Toscano2016-09-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ... instead of requiring progname to be used (or program_name to be provided). * lib/argmatch.c: Do not include progname.h. [TEST] (program_name): Do not define. [TEST] (main): Call getprogname instead of using program_name. * lib/c-stack.c: Do not include progname.h. (program_name): Do not define. (die): Call getprogname instead of using program_name. * lib/chdir-long.c: Do not include progname.h. [TEST_CHDIR] (main): Do not set program_name. * lib/error.c [!_LIBC]: Include progname.h. [!_LIBC] (program_name): Define using getprogname. * lib/euidaccess.c: Do not include progname.h. [TEST] (main): Do not set program_name. * lib/git-merge-changelog.c: Include getprogname.h instead of progname.h. (usage): Call getprogname instead of using program_name. (main): Likewise. Stop calling set_program_name. * lib/group-member.c: Do not include progname.h. [TEST] (main): Do not set program_name. * modules/argmatch (Depends-on): Add getprogname. * modules/c-stack (Depends-on): Likewise. * modules/error (Depends-on): Likewise. * modules/git-merge-changelog (Depends-on): Likewise. Also remove progname.
* c-stack: avoid "ignoring return value of `write'" warningJim Meyering2009-11-211-0/+1
| | | | | | * lib/c-stack.c: Include "ignore-value.h". (die): Explicitly ignore each write return value. * modules/c-stack (Depends-on): Add ignore-value.
* errno: use consistentlyEric Blake2009-09-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/c-stack.c (ENOTSUP): <errno.h> guarantees a definition. * lib/canonicalize-lgpl.c (ENAMETOOLONG): Likewise. * lib/canonicalize.c (ELOOP): Likewise. * lib/inet_ntop.c (EAFNOSUPPORT): Likewise. * lib/inet_pton.c (EAFNOSUPPORT): Likewise. * lib/lchown.c (EOPNOTSUPP): Likewise. * lib/openat-priv.h (ENOSYS, EOPNOTSUPP): Likewise. * lib/savewd.c (ESTALE): Likewise. * lib/settime.c (ENOSYS): Likewise. * lib/utimens.c (ENOSYS): Likewise. * lib/xgethostname.c (ENAMETOOLONG): Likewise. * lib/chdir-safer.c (ELOOP): Likewise. (chdir_no_follow): Use HAVE_READLINK, not ELOOP, as witness. * modules/c-stack (Depends-on): Add errno. * modules/canonicalize (Depends-on): Likewise. * modules/chdir-safer (Depends-on): Likewise. * modules/fdopendir (Depends-on): Likewise. * modules/inet_ntop (Depends-on): Likewise. * modules/inet_pton (Depends-on): Likewise. * modules/lchown (Depends-on): Likewise. * modules/openat (Depends-on): Likewise. * modules/savewd (Depends-on): Likewise. * modules/settime (Depends-on): Likewise. * m4/chdir-safer.m4 (gl_CHDIR_SAFER): Check for readlink. Signed-off-by: Eric Blake <ebb9@byu.net>
* c-stack: fix typo.Eric Blake2008-07-171-1/+1
| | | | | | * modules/c-stack (Link): Fix typo. Signed-off-by: Eric Blake <ebb9@byu.net>
* Make c-stack use libsigsegv, when available.Eric Blake2008-07-171-0/+4
| | | | | | | | | | | | | | | | | | * modules/c-stack (Depends-on): Add libsigsegv. * modules/c-stack-tests (Makefile.am): Link with libsigsegv, if needed. * lib/c-stack.c (SIGSTKSZ): Define fallback. (segv_handler, overflow_handler, c_stack_action) [HAVE_LIBSIGSEGV && !HAVE_XSI_STACK_OVERFLOW_HEURISTIC]: Add new implementation when libsigsegv is available, but only when using the library is necessary. * m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Add comment, explaining why XSI check fails on Linux. (gl_PREREQ_C_STACK): Supply LIBCSTACK, LTLIBCSTACK. * tests/test-c-stack2.sh: Tweak skip message. * NEWS: Document new link-time requirements. Signed-off-by: Eric Blake <ebb9@byu.net>
* Use sigaction module rather than signal().Eric Blake2008-06-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | * modules/c-stack (Depends-on): Add sigaction. * modules/fatal-signal (Depends-on): Likewise. * modules/nanosleep (Depends-on): Likewise. * modules/sigprocmask (Files): Add sig-handler.h. * modules/sigaction (Files): Likewise. * lib/sig-handler.h (get_handler): New file, suggested by Paul Eggert. * lib/c-stack.c (SIGACTION_WORKS): Simplify conditions. (c_stack_action) [!SIGACTION_WORKS]: Use sigaction, not signal. * lib/fatal-signal.c (uninstall_handlers, install_handlers) (init_fatal_signals): Likewise. * lib/nanosleep.c (rpl_nanosleep): Likewise. (siginterrupt): Delete fallback. * lib/sigprocmask.c (handler_t): Delete. (old_handlers): Use sa_handler_t instead. * m4/nanosleep.m4 (gl_PREREQ_NANOSLEEP): Drop check for siginterrupt. Signed-off-by: Eric Blake <ebb9@byu.net>
* Use 'raise'.Bruno Haible2008-04-291-0/+1
|
* * lib/c-stack.c: Include unistd.h unconditionally, since we now assumePaul Eggert2006-03-081-0/+1
| | | | | | | | | | | | | | | | | | the unistd module. * lib/getlogin_r.c: Likewise. * lib/getlogin_r.h: Likewise. * lib/glob.c: Likewise. * lib/pagealign_alloc.c: Likewise. * lib/unistd_.h: Remove; no longer needed. * modules/c-stack (Depends-on): Add unistd. * modules/getlogin_r: Likewise. * modules/glob: Likewise. * modules/pagealign_alloc: Likewise. * modules/unistd (Files): Remove lib/unistd_.h. (EXTRA_DIST): Remove. (unistd.h): Create using 'echo' rather than 'cp', so that we don't need unistd_.h. (MOSTLYCLEANFILES): Remove unistd.h-t.
* Support programs like Emacs that use gnulib but not gettext.Paul Eggert2005-07-061-2/+1
| | | | | | | | | | | | | | | | | | | * MODULES.html.sh (Internationalization functions): Add gettext-h. * modules/gettext-h: New file. * modules/gettext (Files): Remove lib/gettext.h. (Depends-on): Add gettext-h. (Makefile.am): Remove lib_SOURCES. * modules/argmatch, modules/c-stack, modules/closeout: * modules/copy-file, modules/csharpcomp, modules/csharpexec: * modules/execute, modules/file-type, modules/getaddrinfo: * modules/getopt, modules/human, modules/javacomp: * modules/javaexec, modules/mkdir-p, modules/obstack: * modules/openat, modules/pagealign_alloc, modules/pipe: * modules/quotearg, modules/regex, modules/rpmatch: * modules/unicodeio, modules/userspec, modules/version-etc: * modules/wait-process, modules/xalloc-die, modules/xmemcoll: * modules/xsetenv: Depend on gettext-h, not gettext.
* Add a license tag to every module.Bruno Haible2004-09-221-0/+3
|
* Add a Maintainer.Bruno Haible2003-01-201-0/+3
|
* Add module descriptions.Bruno Haible2003-01-131-0/+1
|
* Module description.Bruno Haible2002-12-311-0/+20