]> code.delx.au - gnu-emacs/blobdiff - src/unexcw.c
Simplify use of O_BINARY
[gnu-emacs] / src / unexcw.c
index be8857878ebacadbbcc6389141751d4d638823fc..ea678dd4c25e792a9c755ab4bd287ef893b56f5a 100644 (file)
@@ -1,14 +1,14 @@
 /* unexec() support for Cygwin;
    complete rewrite of xemacs Cygwin unexec() code
 
-   Copyright (C) 2004-2015 Free Software Foundation, Inc.
+   Copyright (C) 2004-2016 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
 GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -21,7 +21,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 #include "unexec.h"
 #include "lisp.h"
-
+#include <string.h>
 #include <stdio.h>
 #include <fcntl.h>
 #include <a.out.h>
@@ -30,10 +30,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define DOTEXE ".exe"
 
-extern void report_sheap_usage (int);
-
-extern int bss_sbrk_did_unexec;
-
 /*
 ** header for Windows executable files
 */
@@ -276,14 +272,12 @@ unexec (const char *outfile, const char *infile)
   int ret;
   int ret2;
 
-  report_sheap_usage (1);
-
   infile = add_exe_suffix_if_necessary (infile, infile_buffer);
   outfile = add_exe_suffix_if_necessary (outfile, outfile_buffer);
 
-  fd_in = emacs_open (infile, O_RDONLY | O_BINARY, 0);
+  fd_in = emacs_open (infile, O_RDONLY, 0);
   assert (fd_in >= 0);
-  fd_out = emacs_open (outfile, O_RDWR | O_TRUNC | O_CREAT | O_BINARY, 0755);
+  fd_out = emacs_open (outfile, O_RDWR | O_TRUNC | O_CREAT, 0755);
   assert (fd_out >= 0);
   for (;;)
     {
@@ -302,9 +296,7 @@ unexec (const char *outfile, const char *infile)
   ret = emacs_close (fd_in);
   assert (ret == 0);
 
-  bss_sbrk_did_unexec = 1;
   fixup_executable (fd_out);
-  bss_sbrk_did_unexec = 0;
 
   ret = emacs_close (fd_out);
   assert (ret == 0);