diff options
| author | Paul Eggert | 2011-07-19 13:33:28 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-07-19 13:33:28 -0700 |
| commit | 0d8de0fd0a5a63cc9558b5c99f9c7f1ddcaf338a (patch) | |
| tree | 31cf6b0a22ba1ee37fef321a296eb288828dc4c6 /src | |
| parent | c2216f8e3a2a17ba5b843f0329ce52c920a336b2 (diff) | |
| parent | 590bd46743151a55ba68a7d211f82b2485c57d3a (diff) | |
| download | emacs-0d8de0fd0a5a63cc9558b5c99f9c7f1ddcaf338a.tar.gz emacs-0d8de0fd0a5a63cc9558b5c99f9c7f1ddcaf338a.zip | |
Merge from trunk.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 50 | ||||
| -rw-r--r-- | src/alloc.c | 10 | ||||
| -rw-r--r-- | src/fileio.c | 35 | ||||
| -rw-r--r-- | src/gnutls.c | 12 | ||||
| -rw-r--r-- | src/lread.c | 56 | ||||
| -rw-r--r-- | src/minibuf.c | 36 | ||||
| -rw-r--r-- | src/process.h | 2 | ||||
| -rw-r--r-- | src/s/openbsd.h | 6 | ||||
| -rw-r--r-- | src/unexelf.c | 4 | ||||
| -rw-r--r-- | src/xdisp.c | 4 |
10 files changed, 147 insertions, 68 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 506396e9583..b72de32ffc3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | 2011-07-17 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-07-19 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | Integer signedness and overflow and related fixes. (Bug#9079) | 3 | Integer signedness and overflow and related fixes. (Bug#9079) |
| 4 | 4 | ||
| @@ -197,6 +197,54 @@ | |||
| 197 | Use EMACS_INT, not EMACS_UINT, for sizes. The code works equally | 197 | Use EMACS_INT, not EMACS_UINT, for sizes. The code works equally |
| 198 | well either way, and we prefer signed to unsigned. | 198 | well either way, and we prefer signed to unsigned. |
| 199 | 199 | ||
| 200 | 2011-07-19 Paul Eggert <eggert@cs.ucla.edu> | ||
| 201 | |||
| 202 | Port to OpenBSD. | ||
| 203 | See http://lists.gnu.org/archive/html/emacs-devel/2011-07/msg00688.html | ||
| 204 | and the surrounding thread. | ||
| 205 | * minibuf.c (read_minibuf_noninteractive): Rewrite to use getchar | ||
| 206 | rather than fgets, and retry after EINTR. Otherwise, 'emacs | ||
| 207 | --batch -f byte-compile-file' fails on OpenBSD if an inactivity | ||
| 208 | timer goes off. | ||
| 209 | * s/openbsd.h (BROKEN_SIGIO): Define. | ||
| 210 | * unexelf.c (unexec) [__OpenBSD__]: | ||
| 211 | Don't update the .mdebug section of the Alpha COFF symbol table. | ||
| 212 | |||
| 213 | 2011-07-19 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 214 | |||
| 215 | * lread.c (syms_of_lread): Clarify when `lexical-binding' is used | ||
| 216 | (bug#8460). | ||
| 217 | |||
| 218 | 2011-07-18 Paul Eggert <eggert@cs.ucla.edu> | ||
| 219 | |||
| 220 | * fileio.c (Fcopy_file) [!MSDOS]: Tighten created file's mask. | ||
| 221 | This fixes some race conditions on the permissions of any newly | ||
| 222 | created file. | ||
| 223 | |||
| 224 | * alloc.c (valid_pointer_p): Use pipe, not open. | ||
| 225 | This fixes some permissions issues when debugging. | ||
| 226 | |||
| 227 | * fileio.c (Fcopy_file): Adjust mode if fchown fails. (Bug#9002) | ||
| 228 | If fchown fails to set both uid and gid, try to set just gid, | ||
| 229 | as that is sometimes allowed. Adjust the file's mode to eliminate | ||
| 230 | setuid or setgid bits that are inappropriate if fchown fails. | ||
| 231 | |||
| 232 | 2011-07-18 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 233 | |||
| 234 | * xdisp.c (next_element_from_string, next_element_from_buffer): Use EQ | ||
| 235 | to compare Lisp_Objects. | ||
| 236 | * gnutls.c (syms_of_gnutls): Rename Vgnutls_log_level to | ||
| 237 | global_gnutls_log_level, don't mistake it for a Lisp_Object. | ||
| 238 | (init_gnutls_functions, emacs_gnutls_handle_error): Fix up uses. | ||
| 239 | |||
| 240 | 2011-07-17 Andreas Schwab <schwab@linux-m68k.org> | ||
| 241 | |||
| 242 | * lread.c (read_integer): Unread even EOF character. | ||
| 243 | (read1): Likewise. Properly record start position of symbol. | ||
| 244 | |||
| 245 | * lread.c (read1): Read `#:' as empty uninterned symbol if no | ||
| 246 | symbol character follows. | ||
| 247 | |||
| 200 | 2011-07-17 Paul Eggert <eggert@cs.ucla.edu> | 248 | 2011-07-17 Paul Eggert <eggert@cs.ucla.edu> |
| 201 | 249 | ||
| 202 | * fileio.c (Fcopy_file): Pacify gcc re fchown. (Bug#9002) | 250 | * fileio.c (Fcopy_file): Pacify gcc re fchown. (Bug#9002) |
diff --git a/src/alloc.c b/src/alloc.c index 5848e797b4b..eb0185a8e35 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -4430,18 +4430,18 @@ valid_pointer_p (void *p) | |||
| 4430 | #ifdef WINDOWSNT | 4430 | #ifdef WINDOWSNT |
| 4431 | return w32_valid_pointer_p (p, 16); | 4431 | return w32_valid_pointer_p (p, 16); |
| 4432 | #else | 4432 | #else |
| 4433 | int fd; | 4433 | int fd[2]; |
| 4434 | 4434 | ||
| 4435 | /* Obviously, we cannot just access it (we would SEGV trying), so we | 4435 | /* Obviously, we cannot just access it (we would SEGV trying), so we |
| 4436 | trick the o/s to tell us whether p is a valid pointer. | 4436 | trick the o/s to tell us whether p is a valid pointer. |
| 4437 | Unfortunately, we cannot use NULL_DEVICE here, as emacs_write may | 4437 | Unfortunately, we cannot use NULL_DEVICE here, as emacs_write may |
| 4438 | not validate p in that case. */ | 4438 | not validate p in that case. */ |
| 4439 | 4439 | ||
| 4440 | if ((fd = emacs_open ("__Valid__Lisp__Object__", O_CREAT | O_WRONLY | O_TRUNC, 0666)) >= 0) | 4440 | if (pipe (fd) == 0) |
| 4441 | { | 4441 | { |
| 4442 | int valid = (emacs_write (fd, (char *)p, 16) == 16); | 4442 | int valid = (emacs_write (fd[1], (char *) p, 16) == 16); |
| 4443 | emacs_close (fd); | 4443 | emacs_close (fd[1]); |
| 4444 | unlink ("__Valid__Lisp__Object__"); | 4444 | emacs_close (fd[0]); |
| 4445 | return valid; | 4445 | return valid; |
| 4446 | } | 4446 | } |
| 4447 | 4447 | ||
diff --git a/src/fileio.c b/src/fileio.c index bdea302a0d6..61713689351 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -38,8 +38,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 38 | #include <selinux/context.h> | 38 | #include <selinux/context.h> |
| 39 | #endif | 39 | #endif |
| 40 | 40 | ||
| 41 | #include <ignore-value.h> | ||
| 42 | |||
| 43 | #include "lisp.h" | 41 | #include "lisp.h" |
| 44 | #include "intervals.h" | 42 | #include "intervals.h" |
| 45 | #include "buffer.h" | 43 | #include "buffer.h" |
| @@ -1939,10 +1937,19 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */) | |||
| 1939 | | (NILP (ok_if_already_exists) ? O_EXCL : 0), | 1937 | | (NILP (ok_if_already_exists) ? O_EXCL : 0), |
| 1940 | S_IREAD | S_IWRITE); | 1938 | S_IREAD | S_IWRITE); |
| 1941 | #else /* not MSDOS */ | 1939 | #else /* not MSDOS */ |
| 1942 | ofd = emacs_open (SSDATA (encoded_newname), | 1940 | { |
| 1943 | O_WRONLY | O_TRUNC | O_CREAT | 1941 | int new_mask = 0666; |
| 1944 | | (NILP (ok_if_already_exists) ? O_EXCL : 0), | 1942 | if (input_file_statable_p) |
| 1945 | 0666); | 1943 | { |
| 1944 | if (!NILP (preserve_uid_gid)) | ||
| 1945 | new_mask = 0600; | ||
| 1946 | new_mask &= st.st_mode; | ||
| 1947 | } | ||
| 1948 | ofd = emacs_open (SSDATA (encoded_newname), | ||
| 1949 | (O_WRONLY | O_TRUNC | O_CREAT | ||
| 1950 | | (NILP (ok_if_already_exists) ? O_EXCL : 0)), | ||
| 1951 | new_mask); | ||
| 1952 | } | ||
| 1946 | #endif /* not MSDOS */ | 1953 | #endif /* not MSDOS */ |
| 1947 | if (ofd < 0) | 1954 | if (ofd < 0) |
| 1948 | report_file_error ("Opening output file", Fcons (newname, Qnil)); | 1955 | report_file_error ("Opening output file", Fcons (newname, Qnil)); |
| @@ -1961,9 +1968,21 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */) | |||
| 1961 | owner and group. */ | 1968 | owner and group. */ |
| 1962 | if (input_file_statable_p) | 1969 | if (input_file_statable_p) |
| 1963 | { | 1970 | { |
| 1971 | int mode_mask = 07777; | ||
| 1964 | if (!NILP (preserve_uid_gid)) | 1972 | if (!NILP (preserve_uid_gid)) |
| 1965 | ignore_value (fchown (ofd, st.st_uid, st.st_gid)); | 1973 | { |
| 1966 | if (fchmod (ofd, st.st_mode & 07777) != 0) | 1974 | /* Attempt to change owner and group. If that doesn't work |
| 1975 | attempt to change just the group, as that is sometimes allowed. | ||
| 1976 | Adjust the mode mask to eliminate setuid or setgid bits | ||
| 1977 | that are inappropriate if the owner and group are wrong. */ | ||
| 1978 | if (fchown (ofd, st.st_uid, st.st_gid) != 0) | ||
| 1979 | { | ||
| 1980 | mode_mask &= ~06000; | ||
| 1981 | if (fchown (ofd, -1, st.st_gid) == 0) | ||
| 1982 | mode_mask |= 02000; | ||
| 1983 | } | ||
| 1984 | } | ||
| 1985 | if (fchmod (ofd, st.st_mode & mode_mask) != 0) | ||
| 1967 | report_file_error ("Doing chmod", Fcons (newname, Qnil)); | 1986 | report_file_error ("Doing chmod", Fcons (newname, Qnil)); |
| 1968 | } | 1987 | } |
| 1969 | #endif /* not MSDOS */ | 1988 | #endif /* not MSDOS */ |
diff --git a/src/gnutls.c b/src/gnutls.c index 52e80a69ae5..3175f55041d 100644 --- a/src/gnutls.c +++ b/src/gnutls.c | |||
| @@ -193,8 +193,7 @@ init_gnutls_functions (Lisp_Object libraries) | |||
| 193 | LOAD_GNUTLS_FN (library, gnutls_x509_crt_import); | 193 | LOAD_GNUTLS_FN (library, gnutls_x509_crt_import); |
| 194 | LOAD_GNUTLS_FN (library, gnutls_x509_crt_init); | 194 | LOAD_GNUTLS_FN (library, gnutls_x509_crt_init); |
| 195 | 195 | ||
| 196 | if (NUMBERP (Vgnutls_log_level)) | 196 | max_log_level = global_gnutls_log_level; |
| 197 | max_log_level = XINT (Vgnutls_log_level); | ||
| 198 | 197 | ||
| 199 | GNUTLS_LOG2 (1, max_log_level, "GnuTLS library loaded:", | 198 | GNUTLS_LOG2 (1, max_log_level, "GnuTLS library loaded:", |
| 200 | SDATA (Fget (Qgnutls_dll, QCloaded_from))); | 199 | SDATA (Fget (Qgnutls_dll, QCloaded_from))); |
| @@ -406,8 +405,7 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err) | |||
| 406 | if (err >= 0) | 405 | if (err >= 0) |
| 407 | return 0; | 406 | return 0; |
| 408 | 407 | ||
| 409 | if (NUMBERP (Vgnutls_log_level)) | 408 | max_log_level = global_gnutls_log_level; |
| 410 | max_log_level = XINT (Vgnutls_log_level); | ||
| 411 | 409 | ||
| 412 | /* TODO: use gnutls-error-fatalp and gnutls-error-string. */ | 410 | /* TODO: use gnutls-error-fatalp and gnutls-error-string. */ |
| 413 | 411 | ||
| @@ -1155,9 +1153,9 @@ syms_of_gnutls (void) | |||
| 1155 | defsubr (&Sgnutls_bye); | 1153 | defsubr (&Sgnutls_bye); |
| 1156 | defsubr (&Sgnutls_available_p); | 1154 | defsubr (&Sgnutls_available_p); |
| 1157 | 1155 | ||
| 1158 | DEFVAR_INT ("gnutls-log-level", Vgnutls_log_level, | 1156 | DEFVAR_INT ("gnutls-log-level", global_gnutls_log_level, |
| 1159 | doc: /* Logging level used by the GnuTLS functions. */); | 1157 | doc: /* Logging level used by the GnuTLS functions. */); |
| 1160 | Vgnutls_log_level = make_number (0); | 1158 | global_gnutls_log_level = 0; |
| 1161 | } | 1159 | } |
| 1162 | 1160 | ||
| 1163 | #endif /* HAVE_GNUTLS */ | 1161 | #endif /* HAVE_GNUTLS */ |
diff --git a/src/lread.c b/src/lread.c index c80ac430671..0613ad037bf 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -2327,8 +2327,7 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix) | |||
| 2327 | c = READCHAR; | 2327 | c = READCHAR; |
| 2328 | } | 2328 | } |
| 2329 | 2329 | ||
| 2330 | if (c >= 0) | 2330 | UNREAD (c); |
| 2331 | UNREAD (c); | ||
| 2332 | *p = '\0'; | 2331 | *p = '\0'; |
| 2333 | } | 2332 | } |
| 2334 | 2333 | ||
| @@ -2583,8 +2582,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2583 | nskip *= 10; | 2582 | nskip *= 10; |
| 2584 | nskip += c - '0'; | 2583 | nskip += c - '0'; |
| 2585 | } | 2584 | } |
| 2586 | if (c >= 0) | 2585 | UNREAD (c); |
| 2587 | UNREAD (c); | ||
| 2588 | 2586 | ||
| 2589 | if (load_force_doc_strings | 2587 | if (load_force_doc_strings |
| 2590 | && (EQ (readcharfun, Qget_file_char) | 2588 | && (EQ (readcharfun, Qget_file_char) |
| @@ -2660,7 +2658,17 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2660 | { | 2658 | { |
| 2661 | uninterned_symbol = 1; | 2659 | uninterned_symbol = 1; |
| 2662 | c = READCHAR; | 2660 | c = READCHAR; |
| 2663 | goto default_label; | 2661 | if (!(c > 040 |
| 2662 | && c != 0x8a0 | ||
| 2663 | && (c >= 0200 | ||
| 2664 | || strchr ("\"';()[]#`,", c) == NULL))) | ||
| 2665 | { | ||
| 2666 | /* No symbol character follows, this is the empty | ||
| 2667 | symbol. */ | ||
| 2668 | UNREAD (c); | ||
| 2669 | return Fmake_symbol (build_string ("")); | ||
| 2670 | } | ||
| 2671 | goto read_symbol; | ||
| 2664 | } | 2672 | } |
| 2665 | /* Reader forms that can reuse previously read objects. */ | 2673 | /* Reader forms that can reuse previously read objects. */ |
| 2666 | if (c >= '0' && c <= '9') | 2674 | if (c >= '0' && c <= '9') |
| @@ -2841,7 +2849,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2841 | next_char = READCHAR; | 2849 | next_char = READCHAR; |
| 2842 | ok = (next_char <= 040 | 2850 | ok = (next_char <= 040 |
| 2843 | || (next_char < 0200 | 2851 | || (next_char < 0200 |
| 2844 | && (strchr ("\"';()[]#?`,.", next_char)))); | 2852 | && strchr ("\"';()[]#?`,.", next_char) != NULL)); |
| 2845 | UNREAD (next_char); | 2853 | UNREAD (next_char); |
| 2846 | if (ok) | 2854 | if (ok) |
| 2847 | return make_number (c); | 2855 | return make_number (c); |
| @@ -2966,11 +2974,6 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2966 | /* Otherwise, READ_BUFFER contains only ASCII. */ | 2974 | /* Otherwise, READ_BUFFER contains only ASCII. */ |
| 2967 | } | 2975 | } |
| 2968 | 2976 | ||
| 2969 | /* We want readchar_count to be the number of characters, not | ||
| 2970 | bytes. Hence we adjust for multibyte characters in the | ||
| 2971 | string. ... But it doesn't seem to be necessary, because | ||
| 2972 | READCHAR *does* read multibyte characters from buffers. */ | ||
| 2973 | /* readchar_count -= (p - read_buffer) - nchars; */ | ||
| 2974 | if (read_pure) | 2977 | if (read_pure) |
| 2975 | return make_pure_string (read_buffer, nchars, p - read_buffer, | 2978 | return make_pure_string (read_buffer, nchars, p - read_buffer, |
| 2976 | (force_multibyte | 2979 | (force_multibyte |
| @@ -2987,7 +2990,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2987 | 2990 | ||
| 2988 | if (next_char <= 040 | 2991 | if (next_char <= 040 |
| 2989 | || (next_char < 0200 | 2992 | || (next_char < 0200 |
| 2990 | && (strchr ("\"';([#?`,", next_char)))) | 2993 | && strchr ("\"';([#?`,", next_char) != NULL)) |
| 2991 | { | 2994 | { |
| 2992 | *pch = c; | 2995 | *pch = c; |
| 2993 | return Qnil; | 2996 | return Qnil; |
| @@ -3002,9 +3005,12 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 3002 | if (c <= 040) goto retry; | 3005 | if (c <= 040) goto retry; |
| 3003 | if (c == 0x8a0) /* NBSP */ | 3006 | if (c == 0x8a0) /* NBSP */ |
| 3004 | goto retry; | 3007 | goto retry; |
| 3008 | |||
| 3009 | read_symbol: | ||
| 3005 | { | 3010 | { |
| 3006 | char *p = read_buffer; | 3011 | char *p = read_buffer; |
| 3007 | int quoted = 0; | 3012 | int quoted = 0; |
| 3013 | EMACS_INT start_position = readchar_count - 1; | ||
| 3008 | 3014 | ||
| 3009 | { | 3015 | { |
| 3010 | char *end = read_buffer + read_buffer_size; | 3016 | char *end = read_buffer + read_buffer_size; |
| @@ -3035,10 +3041,11 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 3035 | else | 3041 | else |
| 3036 | *p++ = c; | 3042 | *p++ = c; |
| 3037 | c = READCHAR; | 3043 | c = READCHAR; |
| 3038 | } while (c > 040 | 3044 | } |
| 3039 | && c != 0x8a0 /* NBSP */ | 3045 | while (c > 040 |
| 3040 | && (c >= 0200 | 3046 | && c != 0x8a0 /* NBSP */ |
| 3041 | || !(strchr ("\"';()[]#`,", c)))); | 3047 | && (c >= 0200 |
| 3048 | || strchr ("\"';()[]#`,", c) == NULL)); | ||
| 3042 | 3049 | ||
| 3043 | if (p == end) | 3050 | if (p == end) |
| 3044 | { | 3051 | { |
| @@ -3051,8 +3058,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 3051 | end = read_buffer + read_buffer_size; | 3058 | end = read_buffer + read_buffer_size; |
| 3052 | } | 3059 | } |
| 3053 | *p = 0; | 3060 | *p = 0; |
| 3054 | if (c >= 0) | 3061 | UNREAD (c); |
| 3055 | UNREAD (c); | ||
| 3056 | } | 3062 | } |
| 3057 | 3063 | ||
| 3058 | if (!quoted && !uninterned_symbol) | 3064 | if (!quoted && !uninterned_symbol) |
| @@ -3080,12 +3086,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 3080 | if (EQ (Vread_with_symbol_positions, Qt) | 3086 | if (EQ (Vread_with_symbol_positions, Qt) |
| 3081 | || EQ (Vread_with_symbol_positions, readcharfun)) | 3087 | || EQ (Vread_with_symbol_positions, readcharfun)) |
| 3082 | Vread_symbol_positions_list = | 3088 | Vread_symbol_positions_list = |
| 3083 | /* Kind of a hack; this will probably fail if characters | 3089 | Fcons (Fcons (result, make_number (start_position)), |
| 3084 | in the symbol name were escaped. Not really a big | ||
| 3085 | deal, though. */ | ||
| 3086 | Fcons (Fcons (result, | ||
| 3087 | make_number (readchar_count | ||
| 3088 | - XFASTINT (Flength (Fsymbol_name (result))))), | ||
| 3089 | Vread_symbol_positions_list); | 3090 | Vread_symbol_positions_list); |
| 3090 | return result; | 3091 | return result; |
| 3091 | } | 3092 | } |
| @@ -4490,10 +4491,9 @@ to load. See also `load-dangerous-libraries'. */); | |||
| 4490 | Qlexical_binding = intern ("lexical-binding"); | 4491 | Qlexical_binding = intern ("lexical-binding"); |
| 4491 | staticpro (&Qlexical_binding); | 4492 | staticpro (&Qlexical_binding); |
| 4492 | DEFVAR_LISP ("lexical-binding", Vlexical_binding, | 4493 | DEFVAR_LISP ("lexical-binding", Vlexical_binding, |
| 4493 | doc: /* If non-nil, use lexical binding when evaluating code. | 4494 | doc: /* Whether to use lexical binding when evaluating code. |
| 4494 | This applies to code evaluated by `eval-buffer' and `eval-region' and | 4495 | Non-nil means that the code in the current buffer should be evaluated |
| 4495 | other commands that call these functions, like `eval-defun' and | 4496 | with lexical binding. |
| 4496 | the like. | ||
| 4497 | This variable is automatically set from the file variables of an | 4497 | This variable is automatically set from the file variables of an |
| 4498 | interpreted Lisp file read using `load'. */); | 4498 | interpreted Lisp file read using `load'. */); |
| 4499 | Fmake_variable_buffer_local (Qlexical_binding); | 4499 | Fmake_variable_buffer_local (Qlexical_binding); |
diff --git a/src/minibuf.c b/src/minibuf.c index cf37c337be4..7e59cf157b5 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -19,6 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | #include <config.h> | 21 | #include <config.h> |
| 22 | #include <errno.h> | ||
| 22 | #include <stdio.h> | 23 | #include <stdio.h> |
| 23 | #include <setjmp.h> | 24 | #include <setjmp.h> |
| 24 | 25 | ||
| @@ -236,8 +237,9 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial, | |||
| 236 | int allow_props, int inherit_input_method) | 237 | int allow_props, int inherit_input_method) |
| 237 | { | 238 | { |
| 238 | ptrdiff_t size, len; | 239 | ptrdiff_t size, len; |
| 239 | char *line, *s; | 240 | char *line; |
| 240 | Lisp_Object val; | 241 | Lisp_Object val; |
| 242 | int c; | ||
| 241 | 243 | ||
| 242 | fprintf (stdout, "%s", SDATA (prompt)); | 244 | fprintf (stdout, "%s", SDATA (prompt)); |
| 243 | fflush (stdout); | 245 | fflush (stdout); |
| @@ -246,22 +248,30 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial, | |||
| 246 | size = 100; | 248 | size = 100; |
| 247 | len = 0; | 249 | len = 0; |
| 248 | line = (char *) xmalloc (size); | 250 | line = (char *) xmalloc (size); |
| 249 | while ((s = fgets (line + len, size - len, stdin)) != NULL | 251 | |
| 250 | && (len = strlen (line), | 252 | while ((c = getchar ()) != '\n') |
| 251 | len == size - 1 && line[len - 1] != '\n')) | ||
| 252 | { | 253 | { |
| 253 | if (STRING_BYTES_BOUND / 2 < size) | 254 | if (c < 0) |
| 254 | memory_full (SIZE_MAX); | 255 | { |
| 255 | size *= 2; | 256 | if (errno != EINTR) |
| 256 | line = (char *) xrealloc (line, size); | 257 | break; |
| 258 | } | ||
| 259 | else | ||
| 260 | { | ||
| 261 | if (len == size) | ||
| 262 | { | ||
| 263 | if (STRING_BYTES_BOUND / 2 < size) | ||
| 264 | memory_full (SIZE_MAX); | ||
| 265 | size *= 2; | ||
| 266 | line = (char *) xrealloc (line, size); | ||
| 267 | } | ||
| 268 | line[len++] = c; | ||
| 269 | } | ||
| 257 | } | 270 | } |
| 258 | 271 | ||
| 259 | if (s) | 272 | if (len) |
| 260 | { | 273 | { |
| 261 | char *nl = strchr (line, '\n'); | 274 | val = make_string (line, len); |
| 262 | if (nl) | ||
| 263 | *nl = '\0'; | ||
| 264 | val = build_string (line); | ||
| 265 | xfree (line); | 275 | xfree (line); |
| 266 | } | 276 | } |
| 267 | else | 277 | else |
diff --git a/src/process.h b/src/process.h index 4866a8c1022..aff9e970f63 100644 --- a/src/process.h +++ b/src/process.h | |||
| @@ -141,7 +141,7 @@ struct Lisp_Process | |||
| 141 | /* Every field in the preceding structure except for the first two | 141 | /* Every field in the preceding structure except for the first two |
| 142 | must be a Lisp_Object, for GC's sake. */ | 142 | must be a Lisp_Object, for GC's sake. */ |
| 143 | 143 | ||
| 144 | #define ChannelMask(n) (1<<(n)) | 144 | #define ChannelMask(n) (1 << (n)) |
| 145 | 145 | ||
| 146 | /* True if we are about to fork off a synchronous process or if we | 146 | /* True if we are about to fork off a synchronous process or if we |
| 147 | are waiting for it. */ | 147 | are waiting for it. */ |
diff --git a/src/s/openbsd.h b/src/s/openbsd.h index 175d61dc9c9..0a8bab2290f 100644 --- a/src/s/openbsd.h +++ b/src/s/openbsd.h | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | /* System file for openbsd. */ | 1 | /* System file for openbsd. */ |
| 2 | 2 | ||
| 3 | /* The same as NetBSD. Note there are differences in configure. */ | 3 | /* Nearly the same as NetBSD. Note there are differences in configure. */ |
| 4 | #include "netbsd.h" | 4 | #include "netbsd.h" |
| 5 | 5 | ||
| 6 | /* The symbol SIGIO is defined, but the feature doesn't work in the | ||
| 7 | way Emacs needs it to. See | ||
| 8 | <http://article.gmane.org/gmane.os.openbsd.ports/46831>. */ | ||
| 9 | #define BROKEN_SIGIO | ||
diff --git a/src/unexelf.c b/src/unexelf.c index 951e7c0eea6..a169ffcb5c8 100644 --- a/src/unexelf.c +++ b/src/unexelf.c | |||
| @@ -1053,7 +1053,7 @@ temacs: | |||
| 1053 | memcpy (NEW_SECTION_H (nn).sh_offset + new_base, src, | 1053 | memcpy (NEW_SECTION_H (nn).sh_offset + new_base, src, |
| 1054 | NEW_SECTION_H (nn).sh_size); | 1054 | NEW_SECTION_H (nn).sh_size); |
| 1055 | 1055 | ||
| 1056 | #ifdef __alpha__ | 1056 | #if defined __alpha__ && !defined __OpenBSD__ |
| 1057 | /* Update Alpha COFF symbol table: */ | 1057 | /* Update Alpha COFF symbol table: */ |
| 1058 | if (strcmp (old_section_names + OLD_SECTION_H (n).sh_name, ".mdebug") | 1058 | if (strcmp (old_section_names + OLD_SECTION_H (n).sh_name, ".mdebug") |
| 1059 | == 0) | 1059 | == 0) |
| @@ -1072,7 +1072,7 @@ temacs: | |||
| 1072 | symhdr->cbRfdOffset += new_data2_size; | 1072 | symhdr->cbRfdOffset += new_data2_size; |
| 1073 | symhdr->cbExtOffset += new_data2_size; | 1073 | symhdr->cbExtOffset += new_data2_size; |
| 1074 | } | 1074 | } |
| 1075 | #endif /* __alpha__ */ | 1075 | #endif /* __alpha__ && !__OpenBSD__ */ |
| 1076 | 1076 | ||
| 1077 | #if defined (_SYSTYPE_SYSV) | 1077 | #if defined (_SYSTYPE_SYSV) |
| 1078 | if (NEW_SECTION_H (nn).sh_type == SHT_MIPS_DEBUG | 1078 | if (NEW_SECTION_H (nn).sh_type == SHT_MIPS_DEBUG |
diff --git a/src/xdisp.c b/src/xdisp.c index 0352867941e..137cbec497c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -6945,7 +6945,7 @@ next_element_from_string (struct it *it) | |||
| 6945 | struct text_pos position; | 6945 | struct text_pos position; |
| 6946 | 6946 | ||
| 6947 | xassert (STRINGP (it->string)); | 6947 | xassert (STRINGP (it->string)); |
| 6948 | xassert (!it->bidi_p || it->string == it->bidi_it.string.lstring); | 6948 | xassert (!it->bidi_p || EQ (it->string, it->bidi_it.string.lstring)); |
| 6949 | xassert (IT_STRING_CHARPOS (*it) >= 0); | 6949 | xassert (IT_STRING_CHARPOS (*it) >= 0); |
| 6950 | position = it->current.string_pos; | 6950 | position = it->current.string_pos; |
| 6951 | 6951 | ||
| @@ -7259,7 +7259,7 @@ next_element_from_buffer (struct it *it) | |||
| 7259 | xassert (IT_CHARPOS (*it) >= BEGV); | 7259 | xassert (IT_CHARPOS (*it) >= BEGV); |
| 7260 | xassert (NILP (it->string) && !it->s); | 7260 | xassert (NILP (it->string) && !it->s); |
| 7261 | xassert (!it->bidi_p | 7261 | xassert (!it->bidi_p |
| 7262 | || (it->bidi_it.string.lstring == Qnil | 7262 | || (EQ (it->bidi_it.string.lstring, Qnil) |
| 7263 | && it->bidi_it.string.s == NULL)); | 7263 | && it->bidi_it.string.s == NULL)); |
| 7264 | 7264 | ||
| 7265 | /* With bidi reordering, the character to display might not be the | 7265 | /* With bidi reordering, the character to display might not be the |