-
Notifications
You must be signed in to change notification settings - Fork 494
/
Copy pathmsys2-patch-2.7.1.patch
72 lines (72 loc) · 2.32 KB
/
msys2-patch-2.7.1.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
diff -Naur patch-2.7.1/src/inp.c patch-2.7.1-p/src/inp.c
--- patch-2.7.1/src/inp.c 2012-09-19 05:07:31 +0400
+++ patch-2.7.1-p/src/inp.c 2013-02-24 13:50:56 +0400
@@ -231,7 +231,11 @@
{
if (S_ISREG (instat.st_mode))
{
+#ifdef __CYGWIN__
+ int ifd = safe_open (filename, O_RDONLY | (binary_transput ?: O_TEXT), 0);
+#else
int ifd = safe_open (filename, O_RDONLY|binary_transput, 0);
+#endif
size_t buffered = 0, n;
if (ifd < 0)
pfatal ("can't open file %s", quotearg (filename));
diff -Naur patch-2.7.1/src/patch.c patch-2.7.1-p/src/patch.c
--- patch-2.7.1/src/patch.c 2012-09-28 14:43:12 +0400
+++ patch-2.7.1-p/src/patch.c 2013-02-24 13:51:50 +0400
@@ -798,7 +798,11 @@
"",
" -d DIR --directory=DIR Change the working directory to DIR first.",
" --reject-format=FORMAT Create 'context' or 'unified' rejects.",
+#ifdef __CYGWIN__
+" --binary Read data in binary mode. Writing data is always binary.",
+#else
" --binary Read and write data in binary mode.",
+#endif
" --read-only=BEHAVIOR How to handle read-only input files: 'ignore' that they",
" are read-only, 'warn' (default), or 'fail'.",
"",
@@ -1526,9 +1530,15 @@
static FILE *
create_output_file (char const *name, int open_flags)
{
+#ifdef __CYGWIN__
+ int fd = create_file (name, O_WRONLY | O_BINARY | open_flags,
+ instat.st_mode, true);
+ FILE *f = fdopen (fd, "wb");
+#else
int fd = create_file (name, O_WRONLY | binary_transput | open_flags,
instat.st_mode, true);
FILE *f = fdopen (fd, binary_transput ? "wb" : "w");
+#endif
if (! f)
pfatal ("Can't create file %s", quotearg (name));
return f;
diff -Naur patch-2.7.1/src/pch.c patch-2.7.1-p/src/pch.c
--- patch-2.7.1/src/pch.c 2012-09-22 21:44:33 +0400
+++ patch-2.7.1-p/src/pch.c 2013-02-24 13:54:00 +0400
@@ -124,8 +124,10 @@
#if HAVE_SETMODE_DOS
if (binary_transput)
{
+#ifndef __CYGWIN__
if (isatty (fileno (pfp)))
fatal ("cannot read binary data from tty on this platform");
+#endif
setmode (fileno (pfp), O_BINARY);
}
#endif
@@ -2393,7 +2395,11 @@
verbosity == VERBOSE ? "" : "- ",
outname);
fflush (stdout);
+#ifdef __CYGWIN__
+ pipefp = popen(buf, "wb");
+#else
pipefp = popen(buf, binary_transput ? "wb" : "w");
+#endif
if (!pipefp)
pfatal ("Can't open pipe to %s", quotearg (buf));
}