Commit 41bed37d authored by Paul Eggert's avatar Paul Eggert
Browse files

* alloc.c (valid_pointer_p): Use pipe, not open.

This fixes some permissions issues when debugging.
parent 3948a513
2011-07-18 Paul Eggert <eggert@cs.ucla.edu>
* alloc.c (valid_pointer_p): Use pipe, not open.
This fixes some permissions issues when debugging.
* fileio.c (Fcopy_file): Adjust mode if fchown fails. (Bug#9002)
If fchown fails to set both uid and gid, try to set just gid,
as that is sometimes allowed. Adjust the file's mode to eliminate
......
......@@ -4415,18 +4415,18 @@ valid_pointer_p (void *p)
#ifdef WINDOWSNT
return w32_valid_pointer_p (p, 16);
#else
int fd;
int fd[2];
/* Obviously, we cannot just access it (we would SEGV trying), so we
trick the o/s to tell us whether p is a valid pointer.
Unfortunately, we cannot use NULL_DEVICE here, as emacs_write may
not validate p in that case. */
if ((fd = emacs_open ("__Valid__Lisp__Object__", O_CREAT | O_WRONLY | O_TRUNC, 0666)) >= 0)
if (pipe (fd) == 0)
{
int valid = (emacs_write (fd, (char *)p, 16) == 16);
emacs_close (fd);
unlink ("__Valid__Lisp__Object__");
int valid = (emacs_write (fd[1], (char *) p, 16) == 16);
emacs_close (fd[1]);
emacs_close (fd[0]);
return valid;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment