aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorPaul Eggert2011-07-18 13:24:40 -0700
committerPaul Eggert2011-07-18 13:24:40 -0700
commit41bed37d157e1a7bdc519bfc3668d59be5b05402 (patch)
tree558defbeb2b05a421bcd23bf272058a0507b8eff /src/alloc.c
parent3948a513790ec17f0a94c48cbabf74b4a7b73566 (diff)
downloademacs-41bed37d157e1a7bdc519bfc3668d59be5b05402.tar.gz
emacs-41bed37d157e1a7bdc519bfc3668d59be5b05402.zip
* alloc.c (valid_pointer_p): Use pipe, not open.
This fixes some permissions issues when debugging.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c10
1 files changed, 5 insertions, 5 deletions
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