aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoakim Verona2011-07-19 11:07:49 +0200
committerJoakim Verona2011-07-19 11:07:49 +0200
commitb41ac9a93de541548e3d5c4e9d53bc7e046bf43a (patch)
tree2ecbfc682cb3a00777f624d788b4fd87faa7a5e6 /src
parentd202b5a0bae129aff4af5db194603e055d29440c (diff)
parent15e3a074a6ebdcefd828a1ba14a5a12ff9921034 (diff)
downloademacs-b41ac9a93de541548e3d5c4e9d53bc7e046bf43a.tar.gz
emacs-b41ac9a93de541548e3d5c4e9d53bc7e046bf43a.zip
webkit back function
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog22
-rw-r--r--src/alloc.c10
-rw-r--r--src/fileio.c35
-rw-r--r--src/gnutls.c12
-rw-r--r--src/process.h2
-rw-r--r--src/xdisp.c4
6 files changed, 62 insertions, 23 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c06c98c5418..484a4420363 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,25 @@
12011-07-18 Paul Eggert <eggert@cs.ucla.edu>
2
3 * fileio.c (Fcopy_file) [!MSDOS]: Tighten created file's mask.
4 This fixes some race conditions on the permissions of any newly
5 created file.
6
7 * alloc.c (valid_pointer_p): Use pipe, not open.
8 This fixes some permissions issues when debugging.
9
10 * fileio.c (Fcopy_file): Adjust mode if fchown fails. (Bug#9002)
11 If fchown fails to set both uid and gid, try to set just gid,
12 as that is sometimes allowed. Adjust the file's mode to eliminate
13 setuid or setgid bits that are inappropriate if fchown fails.
14
152011-07-18 Stefan Monnier <monnier@iro.umontreal.ca>
16
17 * xdisp.c (next_element_from_string, next_element_from_buffer): Use EQ
18 to compare Lisp_Objects.
19 * gnutls.c (syms_of_gnutls): Rename Vgnutls_log_level to
20 global_gnutls_log_level, don't mistake it for a Lisp_Object.
21 (init_gnutls_functions, emacs_gnutls_handle_error): Fix up uses.
22
12011-07-17 Andreas Schwab <schwab@linux-m68k.org> 232011-07-17 Andreas Schwab <schwab@linux-m68k.org>
2 24
3 * lread.c (read_integer): Unread even EOF character. 25 * lread.c (read_integer): Unread even EOF character.
diff --git a/src/alloc.c b/src/alloc.c
index 44f935c243d..d48d1f34dbd 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4415,18 +4415,18 @@ valid_pointer_p (void *p)
4415#ifdef WINDOWSNT 4415#ifdef WINDOWSNT
4416 return w32_valid_pointer_p (p, 16); 4416 return w32_valid_pointer_p (p, 16);
4417#else 4417#else
4418 int fd; 4418 int fd[2];
4419 4419
4420 /* Obviously, we cannot just access it (we would SEGV trying), so we 4420 /* Obviously, we cannot just access it (we would SEGV trying), so we
4421 trick the o/s to tell us whether p is a valid pointer. 4421 trick the o/s to tell us whether p is a valid pointer.
4422 Unfortunately, we cannot use NULL_DEVICE here, as emacs_write may 4422 Unfortunately, we cannot use NULL_DEVICE here, as emacs_write may
4423 not validate p in that case. */ 4423 not validate p in that case. */
4424 4424
4425 if ((fd = emacs_open ("__Valid__Lisp__Object__", O_CREAT | O_WRONLY | O_TRUNC, 0666)) >= 0) 4425 if (pipe (fd) == 0)
4426 { 4426 {
4427 int valid = (emacs_write (fd, (char *)p, 16) == 16); 4427 int valid = (emacs_write (fd[1], (char *) p, 16) == 16);
4428 emacs_close (fd); 4428 emacs_close (fd[1]);
4429 unlink ("__Valid__Lisp__Object__"); 4429 emacs_close (fd[0]);
4430 return valid; 4430 return valid;
4431 } 4431 }
4432 4432
diff --git a/src/fileio.c b/src/fileio.c
index a52e834c2b2..3e1aa54462f 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/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/xdisp.c b/src/xdisp.c
index cd87d00d8d0..816c7d36ce3 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -6968,7 +6968,7 @@ next_element_from_string (struct it *it)
6968 struct text_pos position; 6968 struct text_pos position;
6969 6969
6970 xassert (STRINGP (it->string)); 6970 xassert (STRINGP (it->string));
6971 xassert (!it->bidi_p || it->string == it->bidi_it.string.lstring); 6971 xassert (!it->bidi_p || EQ (it->string, it->bidi_it.string.lstring));
6972 xassert (IT_STRING_CHARPOS (*it) >= 0); 6972 xassert (IT_STRING_CHARPOS (*it) >= 0);
6973 position = it->current.string_pos; 6973 position = it->current.string_pos;
6974 6974
@@ -7294,7 +7294,7 @@ next_element_from_buffer (struct it *it)
7294 xassert (IT_CHARPOS (*it) >= BEGV); 7294 xassert (IT_CHARPOS (*it) >= BEGV);
7295 xassert (NILP (it->string) && !it->s); 7295 xassert (NILP (it->string) && !it->s);
7296 xassert (!it->bidi_p 7296 xassert (!it->bidi_p
7297 || (it->bidi_it.string.lstring == Qnil 7297 || (EQ (it->bidi_it.string.lstring, Qnil)
7298 && it->bidi_it.string.s == NULL)); 7298 && it->bidi_it.string.s == NULL));
7299 7299
7300 /* With bidi reordering, the character to display might not be the 7300 /* With bidi reordering, the character to display might not be the