Files
MINGW-packages/mingw-w64-binutils/libiberty-unlink-handle-windows-nul.patch
2023-01-09 08:48:42 +05:30

16 lines
420 B
Diff

--- a/libiberty/unlink-if-ordinary.c
+++ b/libiberty/unlink-if-ordinary.c
@@ -62,6 +62,12 @@ was made to unlink the file because it is special.
int
unlink_if_ordinary (const char *name)
{
+/* MS-Windows 'stat' function (and in turn, S_ISREG)
+ reports the null device as a regular file. */
+#ifdef _WIN32
+ if (stricmp (name, "nul") == 0)
+ return 1;
+#endif
struct stat st;
if (lstat (name, &st) == 0