]> code.delx.au - gnu-emacs/blobdiff - src/unexw32.c
Clarify documentation of multibyte-string-p.
[gnu-emacs] / src / unexw32.c
index 66071295727c892f11f9d77d4f60df642bc34455..a01ac7995921bd10d0d6eee0785c24869a2fbf61 100644 (file)
@@ -159,6 +159,14 @@ open_output_file (file_data *p_file, char *filename, unsigned long size)
   HANDLE file_mapping;
   void  *file_base;
 
+  /* We delete any existing FILENAME because loadup.el will create a
+     hard link to it under the name emacs-XX.YY.ZZ.nn.exe.  Evidently,
+     overwriting a file on Unix breaks any hard links to it, but that
+     doesn't happen on Windows.  If we don't delete the file before
+     creating it, all the emacs-XX.YY.ZZ.nn.exe end up being hard
+     links to the same file, which defeats the purpose of these hard
+     links: being able to run previous builds.  */
+  DeleteFile (filename);
   file = CreateFile (filename, GENERIC_READ | GENERIC_WRITE, 0, NULL,
                     CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
   if (file == INVALID_HANDLE_VALUE)
@@ -722,7 +730,7 @@ unexec (const char *new_name, const char *old_name)
   /* Ignore old_name, and get our actual location from the OS.  */
   if (!GetModuleFileName (NULL, in_filename, MAX_PATH))
     abort ();
-  dostounix_filename (in_filename);
+  dostounix_filename (in_filename, 0);
   strcpy (out_filename, in_filename);
 
   /* Change the base of the output filename to match the requested name.  */