From: Paul Eggert Date: Mon, 18 Jul 2011 20:24:40 +0000 (-0700) Subject: * alloc.c (valid_pointer_p): Use pipe, not open. X-Git-Tag: emacs-pretest-24.0.90~104^2~200 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=41bed37d157e1a7bdc519bfc3668d59be5b05402;p=emacs.git * alloc.c (valid_pointer_p): Use pipe, not open. This fixes some permissions issues when debugging. --- diff --git a/src/ChangeLog b/src/ChangeLog index 5de5fefd6aa..ca42b696f9c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-07-18 Paul Eggert + * 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 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) #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; }