diff options
| author | Paul Eggert | 2012-07-15 11:18:37 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-07-15 11:18:37 -0700 |
| commit | b6e9e0ffacf249934e92448e85e965e90aa3cf4b (patch) | |
| tree | 21abdf10950da2d63a8841b068b9e360b5e35cc9 /lib | |
| parent | ce811ad97550ff70e2bd71e1ada496b4715d9b08 (diff) | |
| download | emacs-b6e9e0ffacf249934e92448e85e965e90aa3cf4b.tar.gz emacs-b6e9e0ffacf249934e92448e85e965e90aa3cf4b.zip | |
Merge from gnulib.
2012-07-15 pthread_sigmask: fix bug on FreeBSD 9 (Bug#11884)
2012-07-11 gettext: do not assume '#define ... defined ...' behavior
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gettext.h | 9 | ||||
| -rw-r--r-- | lib/pthread_sigmask.c | 27 |
2 files changed, 31 insertions, 5 deletions
diff --git a/lib/gettext.h b/lib/gettext.h index 75875cdb0fb..65ca1e6762e 100644 --- a/lib/gettext.h +++ b/lib/gettext.h | |||
| @@ -183,9 +183,12 @@ npgettext_aux (const char *domain, | |||
| 183 | 183 | ||
| 184 | #include <string.h> | 184 | #include <string.h> |
| 185 | 185 | ||
| 186 | #define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ | 186 | #if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \ |
| 187 | (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \ | 187 | /* || __STDC_VERSION__ >= 199901L */ ) |
| 188 | /* || __STDC_VERSION__ >= 199901L */ ) | 188 | # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1 |
| 189 | #else | ||
| 190 | # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0 | ||
| 191 | #endif | ||
| 189 | 192 | ||
| 190 | #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS | 193 | #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS |
| 191 | #include <stdlib.h> | 194 | #include <stdlib.h> |
diff --git a/lib/pthread_sigmask.c b/lib/pthread_sigmask.c index 4a150e70e9f..80ab24bf0b1 100644 --- a/lib/pthread_sigmask.c +++ b/lib/pthread_sigmask.c | |||
| @@ -22,6 +22,10 @@ | |||
| 22 | #include <errno.h> | 22 | #include <errno.h> |
| 23 | #include <stddef.h> | 23 | #include <stddef.h> |
| 24 | 24 | ||
| 25 | #if PTHREAD_SIGMASK_INEFFECTIVE | ||
| 26 | # include <string.h> | ||
| 27 | #endif | ||
| 28 | |||
| 25 | #if PTHREAD_SIGMASK_UNBLOCK_BUG | 29 | #if PTHREAD_SIGMASK_UNBLOCK_BUG |
| 26 | # include <unistd.h> | 30 | # include <unistd.h> |
| 27 | #endif | 31 | #endif |
| @@ -31,7 +35,22 @@ pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask) | |||
| 31 | #undef pthread_sigmask | 35 | #undef pthread_sigmask |
| 32 | { | 36 | { |
| 33 | #if HAVE_PTHREAD_SIGMASK | 37 | #if HAVE_PTHREAD_SIGMASK |
| 34 | int ret = pthread_sigmask (how, new_mask, old_mask); | 38 | int ret; |
| 39 | |||
| 40 | # if PTHREAD_SIGMASK_INEFFECTIVE | ||
| 41 | sigset_t omask, omask_copy; | ||
| 42 | sigset_t *old_mask_ptr = &omask; | ||
| 43 | sigemptyset (&omask); | ||
| 44 | /* Add a signal unlikely to be blocked, so that OMASK_COPY | ||
| 45 | is unlikely to match the actual mask. */ | ||
| 46 | sigaddset (&omask, SIGILL); | ||
| 47 | memcpy (&omask_copy, &omask, sizeof omask); | ||
| 48 | # else | ||
| 49 | sigset_t *old_mask_ptr = old_mask; | ||
| 50 | # endif | ||
| 51 | |||
| 52 | ret = pthread_sigmask (how, new_mask, old_mask_ptr); | ||
| 53 | |||
| 35 | # if PTHREAD_SIGMASK_INEFFECTIVE | 54 | # if PTHREAD_SIGMASK_INEFFECTIVE |
| 36 | if (ret == 0) | 55 | if (ret == 0) |
| 37 | { | 56 | { |
| @@ -39,12 +58,16 @@ pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask) | |||
| 39 | Don't cache the information: libpthread.so could be dynamically | 58 | Don't cache the information: libpthread.so could be dynamically |
| 40 | loaded after the program started and after pthread_sigmask was | 59 | loaded after the program started and after pthread_sigmask was |
| 41 | called for the first time. */ | 60 | called for the first time. */ |
| 42 | if (pthread_sigmask (1729, NULL, NULL) == 0) | 61 | if (memcmp (&omask_copy, &omask, sizeof omask) == 0 |
| 62 | && pthread_sigmask (1729, &omask_copy, NULL) == 0) | ||
| 43 | { | 63 | { |
| 44 | /* pthread_sigmask is currently ineffective. The program is not | 64 | /* pthread_sigmask is currently ineffective. The program is not |
| 45 | linked to -lpthread. So use sigprocmask instead. */ | 65 | linked to -lpthread. So use sigprocmask instead. */ |
| 46 | return (sigprocmask (how, new_mask, old_mask) < 0 ? errno : 0); | 66 | return (sigprocmask (how, new_mask, old_mask) < 0 ? errno : 0); |
| 47 | } | 67 | } |
| 68 | |||
| 69 | if (old_mask) | ||
| 70 | memcpy (old_mask, &omask, sizeof omask); | ||
| 48 | } | 71 | } |
| 49 | # endif | 72 | # endif |
| 50 | # if PTHREAD_SIGMASK_FAILS_WITH_ERRNO | 73 | # if PTHREAD_SIGMASK_FAILS_WITH_ERRNO |