From: Eli Zaretskii Date: Tue, 16 Apr 2013 18:08:03 +0000 (+0300) Subject: Delete previous emacs.exe before dumping to fix problem with hard links to it. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~229^2~63^2~31 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2d0d2952da64bae2af67014b22a3b8caa9aef810;p=emacs.git Delete previous emacs.exe before dumping to fix problem with hard links to it. --- diff --git a/src/unexw32.c b/src/unexw32.c index e8b553a87d3..a01ac799592 100644 --- a/src/unexw32.c +++ b/src/unexw32.c @@ -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)