summaryrefslogtreecommitdiff
path: root/lib/c-stack.c
Commit message (Collapse)AuthorAgeFilesLines
* gnulib-common.m4: Use C2x [[maybe_unused]] when possible.Bruno Haible2021-08-221-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * m4/gnulib-common.m4 (gl_COMMON_BODY): Define _GL_UNUSED as an alias of _GL_ATTRIBUTE_MAYBE_UNUSED, not of _GL_ATTRIBUTE_UNUSED. * lib/binary-io.h (__gl_setmode): Put _GL_UNUSED before, not after, the declaration. * lib/c-stack.c (null_action, segv_handler, overflow_handler, c_stack_action): Likewise. * lib/chown.c (chown): Likewise. * lib/clean-temp-simple.c (cleanup_action): Likewise. * lib/fts.c (dirent_inode_sort_may_be_useful, leaf_optimization, fts_set): Likewise. * lib/getgroups.c (getgroups): Likewise. * lib/getopt.c (_getopt_initialize): Likewise. * lib/getugroups.c (getugroups): Likewise. * lib/localename.c (gl_locale_name_thread_unsafe, gl_locale_name_thread, gl_locale_name_posix, gl_locale_name_environ): Likewise. * lib/mkdir.c (rpl_mkdir): Likewise. * lib/mkfifo.c (mkfifo): Likewise. * lib/mkfifoat.c (mkfifoat): Likewise. * lib/mknod.c (mknod): Likewise. * lib/mknodat.c (mknodat): Likewise. * lib/mountlist.c (me_remote): Likewise. * lib/openpty.c (openpty): Likewise. * lib/parse-datetime.y (yyerror): Likewise. * lib/passfd.c (sendfd, recvfd): Likewise. * lib/pthread-cond.c (pthread_condattr_destroy, pthread_cond_init, pthread_cond_wait, pthread_cond_timedwait, pthread_cond_signal, pthread_cond_broadcast, pthread_cond_destroy): Likewise. * lib/pthread-mutex.c (pthread_mutexattr_destroy, pthread_mutex_init, pthread_mutex_lock, pthread_mutex_trylock, pthread_mutex_timedlock, pthread_mutex_unlock, pthread_mutex_destroy): Likewise. * lib/pthread-rwlock.c (pthread_rwlockattr_destroy, pthread_rwlock_init, pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlock): Likewise. * lib/pthread-spin.c (pthread_spin_init, pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock, pthread_spin_destroy): Likewise. * lib/pthread-thread.c (pthread_attr_destroy): Likewise. * lib/readlink.c (readlink): Likewise. * lib/rename.c (rpl_rename): Likewise. * lib/set-permissions.c (set_permissions): Likewise. * lib/sockets.c (gl_sockets_startup): Likewise. * lib/stat-time.h (get_stat_birthtime_ns, get_stat_birthtime, stat_time_normalize): Likewise. * lib/strptime.c (__strptime_internal): Likewise. * lib/strtod.c (LDEXP): Likewise. * lib/symlink.c (symlink): Likewise. * lib/symlinkat.c (symlinkat): Likewise. * lib/tempname.c (try_dir, try_nocreate): Likewise. * lib/textstyle.in.h (styled_ostream_begin_use_class, styled_ostream_end_use_class, styled_ostream_get_hyperlink_ref, styled_ostream_get_hyperlink_id, styled_ostream_set_hyperlink, styled_ostream_flush_to_current_style, fd_ostream_create, term_ostream_get_color, term_ostream_set_color, term_ostream_get_bgcolor, term_ostream_set_bgcolor, term_ostream_get_weight, term_ostream_set_weight, term_ostream_get_posture, term_ostream_set_posture, term_ostream_get_underline, term_ostream_set_underline, term_ostream_get_hyperlink_ref, term_ostream_get_hyperlink_id, term_ostream_set_hyperlink, term_ostream_create, term_styled_ostream_create, html_styled_ostream_create, handle_color_option, handle_style_option, style_file_prepare, styled_ostream_create, libtextstyle_set_failure_exit_code): Likewise. * lib/unicodeio.c (exit_failure_callback, fallback_failure_callback): Likewise. * lib/wait-process.c (cleanup_slaves_action): Likewise. * tests/signature.h (SIGNATURE_CHECK2): Likewise. * tests/test-areadlink.c (do_areadlink): Likewise. * tests/test-areadlinkat.c (do_areadlinkat): Likewise. * tests/test-ceilf-ieee.c (main): Likewise. * tests/test-ceilf1.c (main): Likewise. * tests/test-dirent.c (dir): Likewise. * tests/test-fchownat.c (main): Likewise. * tests/test-fdopendir.c (main): Likewise. * tests/test-filenamecat.c (main): Likewise. * tests/test-floor1.c (main): Likewise. * tests/test-floorf-ieee.c (main): Likewise. * tests/test-floorf1.c (main): Likewise. * tests/test-fseeko.c (main): Likewise. * tests/test-fstatat.c (main): Likewise. * tests/test-ftello.c (main): Likewise. * tests/test-getdomainname.c (main): Likewise. * tests/test-getgroups.c (main): Likewise. * tests/test-gethostname.c (main): Likewise. * tests/test-math-c++.cc (OVERLOADED_CHECK): Likewise. * tests/test-mkdirat.c (main): Likewise. * tests/test-openat.c (main): Likewise. * tests/test-parse-datetime.c (main): Likewise. * tests/test-quotearg-simple.c (main): Likewise. * tests/test-quotearg.c (main): Likewise. * tests/test-sethostname2.c (main): Likewise. * tests/test-unlinkat.c (main): Likewise. * tests/test-version-etc.c (main): Likewise. * tests/test-xalloc-die.c (main): Likewise. * tests/test-xfprintf-posix.c (main): Likewise. * tests/test-xprintf-posix.c (main): Likewise. * tests/test-xvasprintf.c (main): Likewise.
* c-stack: Support catching stack overflow on most platforms without libsigsegv.Bruno Haible2021-05-181-181/+7
| | | | | | | | | | * 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: work around Solaris 11 bugsPaul Eggert2021-05-141-8/+17
| | | | | | | | | | | | | | Problem reported by Bruno Haible in: https://lists.gnu.org/r/bug-gnulib/2021-05/msg00062.html * lib/c-stack.c: Always include sigsegv.h if HAVE_LIBSIGSEGV. (USE_LIBSIGSEGV): Do not use libsigsegv if the kernel has the si_addr bug and libsigsegv is too old to work around it. (segv_handler) [!USE_LIBSIGSEGV]: Do not trust si_addr if BOGUS_SI_ADDR_UPON_STACK_OVERFLOW. * m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Define BOGUS_SI_ADDR_UPON_STACK_OVERFLOW on Solaris 2.11 SPARC. And do not define HAVE_XSI_STACK_OVERFLOW_HEURISTIC.
* c-stack: Don't use an undefined C macro (regression from 2020-10-04).Bruno Haible2021-04-151-1/+1
| | | | * lib/c-stack.c: Test GNU C version directly, without __GNUC_PREREQ.
* maint: run 'make update-copyright'Paul Eggert2020-12-311-1/+1
|
* c-stack: Use idx_t for nonnegative ptrdiff_t variables.Bruno Haible2020-12-061-4/+6
| | | | | | * lib/c-stack.c: Include idx.h. (die): Mark buflen as nonnegative. * modules/c-stack (Depends-on): Add idx.
* c-stack: pacify GCC 9.3.1 when using libsigsegvPaul Eggert2020-10-041-0/+5
| | | | * lib/c-stack.c [USE_LIBSIGSEGV]: Disable --suggest-attribute=pure.
* c-stack: streamline Solaris configurationPaul Eggert2020-10-031-5/+3
| | | | | | | | | | | | * 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: stop using SIGSTKSZPaul Eggert2020-10-031-24/+18
| | | | | | | | | | It’s been proposed to stop making SIGSTKSZ an integer constant: https://sourceware.org/pipermail/libc-alpha/2020-September/118028.html Also, using SIGSTKSZ in #if did not conform to current POSIX. Also, avoiding SIGSTKSZ makes the code simpler and easier to grok. * lib/c-stack.c (SIGSTKSZ): Remove. (alternate_signal_stack): Now a 64 KiB array, for simplicity. All uses changed.
* c-stack: fix libsigsegv typoPaul Eggert2020-10-031-1/+1
| | | | | | | Problem reported by Bruno Haible in: https://lists.gnu.org/r/bug-gnulib/2020-09/msg00175.html * lib/c-stack.c (USE_LIBSIGSEGV): Fix typo that caused libsigsegv to be used only on Solaris (exactly where it is not needed!).
* c-stack: output diagnostic in single 'write'Paul Eggert2020-09-201-9/+30
| | | | | | | * 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-56/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* c-stack: pacify -Wunused-result when DEBUGPaul Eggert2020-05-151-3/+3
| | | | | | | Problem reported by Marc Nieper-Wißkirchen in: https://lists.gnu.org/r/bug-gnulib/2020-05/msg00132.html * lib/c-stack.c (segv_handler, overflow_handler, segv_handler) [DEBUG]: Explicitly ignore write failures.
* c-stack: Fix warning when DEBUG is enabled.Bruno Haible2020-05-091-0/+4
| | | | | | | Patch suggested by Marc Nieper-Wißkirchen <marc.nieper+gnu@gmail.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00081.html>. * lib/c-stack.c: Include <stdio.h>.
* attribute: new modulePaul Eggert2020-05-031-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This simplifies use of GCC and C2X attributes like ‘deprecated’. * MODULES.html.sh: Add attribute. * doc/attribute.texi, lib/attribute.h, modules/attribute: New files. * doc/gnulib.texi (Particular Modules): Add Attributes. * lib/backupfile.c, lib/fnmatch.c, lib/freopen-safer.c: * lib/mbrtoc32.c, lib/mbrtowc.c, lib/nstrftime.c, lib/quotearg.c: * lib/savewd.c, lib/unistr/u8-uctomb-aux.c, lib/unistr/u8-uctomb.c: * lib/vasnprintf.c: Include attribute.h, and let it define FALLTHROUGH. * lib/bitset/base.h, lib/c-stack.c (__attribute__): Remove macro. * lib/bitset/base.h (ATTRIBUTE_UNUSED): Define in terms of _GL_ATTRIBUTE_MAYBE_UNUSED, for forwards compatibility to C2X. * lib/dfa.c (FALLTHROUGH): Define consistently with gl_COMMON_BODY. This is a copy since Gawk doesn’t use Gnulib. * lib/di-set.h (_GL_ATTRIBUTE_NONNULL): Remove definition that is incompatible with gl_COMMON_BODY’s. All uses changed. * lib/fts.c: Include attribte.h, for FALLTHROUGH. Keep the existing FALLTHROUGH definition since Glibc might use it, and it does no harm to Gnulib’s FALLTHROUGH. * lib/fts_.h, lib/inttostr.h: (__GNUC_PREREQ): Remove; no longer needed. (__attribute_warn_unused_result__): Remove. All uses replaced by _GL_ATTRIBUTE_NODISCARD. * lib/gl_list.h, lib/gl_map.h, lib/gl_omap.h, lib/gl_oset.h: * lib/gl_set.h: Prefer _GL_ATTRIBUTE_NODISCARD to an ifdeffed __attribute__ ((__warn_unused_result__)), for forward compatibility to C2X. * lib/hash.h (_GL_ATTRIBUTE_WUR): Remove. All uses replaced by _GL_ATTRIBUTE_NODISCARD. (_GL_ATTRIBUTE_DEPRECATED): Remove, since gl_COMMON_BODY defines it. * lib/ino-map.h (_GL_ATTRIBUTE_NONNULL): Remove. All uses replaced by gl_COMMON_BODY’s implementation, which has a slightly different signature. * lib/safe-alloc.h (_GL_ATTRIBUTE_RETURN_CHECK): Remove. All uses replaced by _GL_ATTRIBUTE_NODISCARD. * lib/unused-parameter.h (_GL_UNUSED_PARAMETER): Define in terms of _GL_ATTRIBUTE_MAYBE_UNUSED. No doubt all uses should be replaced, at some point. * m4/gnulib-common.m4 (_GL_GNUC_PREREQ): New macro. (_Noreturn): Use it. (_GL_HAS_ATTRIBUTE, _GL_ATTRIBUTE_ALLOC_SIZE) (_GL_ATTRIBUTE_ALWAYS_INLINE, _GL_ATTRIBUTE_ARTIFICIAL) (_GL_ATTRIBUTE_COLD) (_GL_ATTRIBUTE_DEPRECATED, _GL_ATTRIBUTE_ERROR) (_GL_ATTRIBUTE_WARNING, _GL_ATTRIBUTE_EXTERNALLY_VISIBLE) (_GL_ATTRIBUTE_FALLTHROUGH, _GL_ATTRIBUTE_FORMAT) (_GL_ATTRIBUTE_LEAF, _GL_ATTRIBUTE_MAY_ALIAS) (_GL_ATTRIBUTE_MAYBE_UNUSED) (_GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE) (_GL_ATTRIBUTE_NONNULL, _GL_ATTRIBUTE_NONSTRING) (_GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED, _GL_ATTRIBUTE_PURE) (_GL_ATTRIBUTE_SENTINEL): New macros. * modules/backup-rename, modules/backupfile, modules/c-vasnprintf: * modules/fnmatch, modules/freopen-safer, modules/fts: * modules/mbrtoc32, modules/mbrtowc, modules/nstrftime: * modules/quotearg, modules/savewd: * modules/unistdio/u16-u16-vasnprintf: * modules/unistdio/u16-vasnprintf: * modules/unistdio/u32-u32-vasnprintf: * modules/unistdio/u32-vasnprintf: * modules/unistdio/u8-u8-vasnprintf: * modules/unistdio/u8-vasnprintf: * modules/unistdio/ulc-vasnprintf: * modules/unistr/u8-uctomb, modules/vasnprintf: (Depends-on:): Add attribute module.
* maint: Run 'make update-copyright'Paul Eggert2019-12-311-1/+1
|
* c-stack: Make signal handlers more reliable.Bruno Haible2019-03-191-1/+7
| | | | | | | * lib/c-stack.c (progname): New variable. (die): Use it. (c_stack_action): Initialize it. (segv_handler): Save and restore errno.
* Help making signal handlers more reliable.Bruno Haible2019-03-191-15/+13
| | | | | | | | | | | | | | | * m4/gnulib-common.m4 (gl_COMMON_BODY): Emit definition of _GL_ASYNC_SAFE into config.h. * lib/nanosleep.c (sighandler): Mark as _GL_ASYNC_SAFE. * lib/fatal-signal.h (at_fatal_signal): Add _GL_ASYNC_SAFE marker to argument. * lib/fatal-signal.c (action_t, uninstall_handlers, fatal_signal_handler): Mark as _GL_ASYNC_SAFE. * lib/clean-temp.c (cleanup_action): Mark as _GL_ASYNC_SAFE. * lib/wait-process.c (cleanup_slaves, cleanup_slaves_action): Mark as _GL_ASYNC_SAFE. * lib/c-stack.h (c_stack_action): Add _GL_ASYNC_SAFE marker to argument. * lib/c-stack.c: Add _GL_ASYNC_SAFE markers.
* maint: Run 'make update-copyright'Paul Eggert2019-01-011-1/+1
|
* c-stack: Fix possible build failure on some platforms.Bruno Haible2018-03-281-1/+1
| | | | * lib/c-stack.c (die): Define whenever this function is referenced.
* c-stack: port to recent GCC buildPaul Eggert2018-03-231-0/+5
| | | | | Problem reported by The Fireplace (Bug#30913). * lib/c-stack.c (die): Define only if used.
* maint: Run 'make update-copyright'Paul Eggert2018-01-011-1/+1
|
* all: prefer https: URLsPaul Eggert2017-09-131-1/+1
|
* version-etc: new yearPaul Eggert2017-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* Port modules to use getprogname explicitlyPino Toscano2016-09-051-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ... 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.
* version-etc: new yearPaul Eggert2016-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* version-etc: new yearPaul Eggert2014-12-311-1/+1
| | | | | | * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
* maint: update copyrightEric Blake2014-01-011-1/+1
| | | | | | I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: update all copyright year number rangesEric Blake2013-01-011-1/+1
| | | | | | Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: spelling fixesPaul Eggert2012-02-051-1/+1
|
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* c-stack: use _NoreturnPaul Eggert2011-07-121-7/+3
| | | | | * lib/c-stack.c (die, overflow_handler, segv_handler): Use _Noreturn rather than __attribute__((noreturn)).
* c-stack: stop worrying about stack directionPaul Eggert2011-06-201-22/+3
| | | | | | | | | | * lib/c-stack.c (find_stack_direction): Remove. (segv_handler): Don't worry about stack direction growth, as it's too much of a pain to configure this correctly, given how compilers are optimizing-away our stack-growth detection code. Instead, assume that any access to just before or just after the stack is OK. * m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Don't require AC_FUNC_ALLOCA; no longer needed.
* c-stack: fix regression on cygwin when libsigsegv is presentEric Blake2011-01-251-2/+2
| | | | | | * lib/c-stack.c (die): Don't flatten error if sigsegv is present. Signed-off-by: Eric Blake <eblake@redhat.com>
* c-stack: assume stack overflow if SA_SIGINFO unsupportedEric Blake2011-01-191-5/+11
| | | | | | | | | | | * lib/c-stack.c (SIGACTION_WORKS): Rename... (SIGINFO_WORKS): ...since gnulib module guarantees that (most) of sigaction will work. (die): Assume stack overflow if siginfo doesn't work, to let Haiku behavior match Linux. * tests/test-c-stack.c (main): Prefer NULL for pointers. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-2/+1
| | | | Run the new "make update-copyright" rule.
* c-stack: work around libsigsegv 2.8 bugEric Blake2010-10-211-0/+6
| | | | | | | * lib/c-stack.c (SIGSTKSZ): Increase size to avoid alternate stack overflow on at least PowerPC64. Signed-off-by: Eric Blake <eblake@redhat.com>
* update nearly all FSF copyright year lists to include 2010Jim Meyering2010-01-011-2/+2
| | | | | Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
* Use spaces for indentation, not tabs.Bruno Haible2009-12-101-15/+15
|
* c-stack: avoid defining an unused static functionJim Meyering2009-11-221-0/+2
| | | | | * lib/c-stack.c (find_stack_direction): Do not define this function when it will not be used.
* c-stack: avoid "ignoring return value of `write'" warningJim Meyering2009-11-211-4/+5
| | | | | | * 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-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* On HP-UX, don't pretend it was a SIGSEGV when it was a stack overflow.Bruno Haible2009-01-241-14/+14
|
* unistd: guarantee STDIN_FILENO here, for OS/2 EMXEric Blake2009-01-191-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | * lib/unistd.in.h (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO): Guarantee a definition. * doc/posix-headers/unistd.texi (unistd.h): Document the bug. * modules/unistd-safer (Depends-on): Add dependency on unistd. * lib/c-stack.c (STDERR_FILENO): Rely on <unistd.h>. * lib/dup-safer.c (STDERR_FILENO): Likewise. * lib/execute.c (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO): Likewise. * lib/fd-safer.c (STDIN_FILENO, STDERR_FILENO): Likewise. * lib/fopen-safer.c (STDERR_FILENO): Likewise. * lib/pipe.c (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO): Likewise. * lib/tmpfile-safer.c (STDERR_FILENO): Likewise. * tests/test-posix_spawn1.c (STDIN_FILENO, STDOUT_FILENO) (STDERR_FILENO): Likewise. * tests/test-posix_spawn2.c (STDIN_FILENO, STDOUT_FILENO) (STDERR_FILENO): Likewise. * tests/test-posix_spawn3.c (STDIN_FILENO, STDOUT_FILENO) (STDERR_FILENO): Likewise. Reported by Elbert Pol. Signed-off-by: Eric Blake <ebb9@byu.net>
* Make c-stack work on Haiku.Ingo Weinhold2008-12-231-1/+4
|
* Treat SIGBUS like SIFSEGV on platforms that need it.Bruno Haible2008-12-061-0/+4
|
* c-stack: work around Irix sigaltstack bugEric Blake2008-09-231-0/+7
| | | | | | | | | | | | * m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Check whether sigaltstack uses wrong end of stack_t (copied in part from libsigsegv). * lib/c-stack.c (c_stack_action) [!HAVE_LIBSIGSEGV]: Work around Irix bug, without requiring an over-allocation. * doc/posix-functions/sigaltstack.texi (sigaltstack): Document the bug. Signed-off-by: Eric Blake <ebb9@byu.net>
* c-stack: test that stack overflow can be caughtEric Blake2008-08-251-3/+5
| | | | | | | | | | | | * m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Also check that platform allows handling stack overflow; at least OS/2 EMX has sigaltstack, but crashes before transferring control to handler on stack overflow. * lib/c-stack.c [HAVE_SIGALTSTACK]: Adjust conditions to also check for HAVE_STACK_OVERFLOW_HANDLING. Reported by Elbert Pol. Signed-off-by: Eric Blake <ebb9@byu.net>
* Improve documentation.Bruno Haible2008-07-201-30/+0
|
* Make c-stack use libsigsegv, when available.Eric Blake2008-07-171-22/+128
| | | | | | | | | | | | | | | | | | * 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>