From: Eli Zaretskii Date: Mon, 5 Nov 2012 16:30:45 +0000 (+0200) Subject: Fix bug #12805 with compilation error in the cygw32 build. X-Git-Tag: emacs-24.3.90~173^2~9^2~153 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c8e3a9c3db7dfb5a04ec2bf4b1aae55809f94de4;p=emacs.git Fix bug #12805 with compilation error in the cygw32 build. src/makefile.w32-in ($(BLD)/w32fns.$(O)): Depend on $(NT_INC)/unistd.h. src/w32fns.c Include unistd.h, to avoid compiler warnings on Cygwin. (emacs_abort) [CYGWIN]: Don't call _open_osfhandle; instead, use file descriptor 2 for standard error. --- diff --git a/src/ChangeLog b/src/ChangeLog index d0f42dd2394..1924c08cacb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2012-11-05 Eli Zaretskii + + * makefile.w32-in ($(BLD)/w32fns.$(O)): Depend on $(NT_INC)/unistd.h. + + * w32fns.c Include unistd.h, to avoid compiler warnings on Cygwin. + (emacs_abort) [CYGWIN]: Don't call _open_osfhandle; instead, use + file descriptor 2 for standard error. + 2012-11-05 Chong Yidong * process.c (wait_reading_process_output): Revert previous change. diff --git a/src/makefile.w32-in b/src/makefile.w32-in index 5be1ccb70df..9df5dedb7ea 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -1564,6 +1564,7 @@ $(BLD)/w32fns.$(O) : \ $(SRC)/w32.h \ $(SRC)/w32common.h \ $(SRC)/w32heap.h \ + $(NT_INC)/unistd.h \ $(BUFFER_H) \ $(CCL_H) \ $(CHARACTER_H) \ diff --git a/src/w32fns.c b/src/w32fns.c index 74bb2375ea5..18e29ecaaf5 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -27,6 +27,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include #include "lisp.h" #include "w32term.h" @@ -7749,12 +7750,19 @@ emacs_abort (void) if (i) { +#ifdef CYGWIN + int stderr_fd = 2; +#else HANDLE errout = GetStdHandle (STD_ERROR_HANDLE); - int stderr_fd = -1, errfile_fd = -1; + int stderr_fd = -1; +#endif + int errfile_fd = -1; int j; +#ifndef CYGWIN if (errout && errout != INVALID_HANDLE_VALUE) stderr_fd = _open_osfhandle ((intptr_t)errout, O_APPEND | O_BINARY); +#endif if (stderr_fd >= 0) write (stderr_fd, "\r\nBacktrace:\r\n", 14); errfile_fd = _open ("emacs_backtrace.txt", O_RDWR | O_CREAT | O_BINARY, S_IREAD | S_IWRITE);